2023-06-09 18:21:18 +10:00
|
|
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
2023-11-24 16:17:54 +11:00
|
|
|
|
const fs = require('fs');
|
2023-06-09 18:21:18 +10:00
|
|
|
|
const path = require('path');
|
2023-09-11 11:34:10 +03:00
|
|
|
|
const { version } = require('./package.json');
|
2024-04-03 15:32:34 +08:00
|
|
|
|
const { withAxiom } = require('next-axiom');
|
2023-06-09 18:21:18 +10:00
|
|
|
|
|
2023-10-18 23:19:29 +11:00
|
|
|
|
const ENV_FILES = ['.env', '.env.local', `.env.${process.env.NODE_ENV || 'development'}`];
|
|
|
|
|
|
|
|
|
|
|
|
ENV_FILES.forEach((file) => {
|
|
|
|
|
|
require('dotenv').config({
|
|
|
|
|
|
path: path.join(__dirname, `../../${file}`),
|
|
|
|
|
|
});
|
2023-06-09 18:21:18 +10:00
|
|
|
|
});
|
2023-01-07 15:45:03 +01:00
|
|
|
|
|
2023-11-24 16:17:54 +11:00
|
|
|
|
// !: This is a temp hack to get caveat working without placing it back in the public directory.
|
|
|
|
|
|
// !: By inlining this at build time we should be able to sign faster.
|
|
|
|
|
|
const FONT_CAVEAT_BYTES = fs.readFileSync(
|
|
|
|
|
|
path.join(__dirname, '../../packages/assets/fonts/caveat.ttf'),
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2024-05-23 13:07:37 +10:00
|
|
|
|
const FONT_NOTO_SANS_BYTES = fs.readFileSync(
|
|
|
|
|
|
path.join(__dirname, '../../packages/assets/fonts/noto-sans.ttf'),
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2023-05-05 19:29:42 +10:00
|
|
|
|
/** @type {import('next').NextConfig} */
|
2023-06-09 18:21:18 +10:00
|
|
|
|
const config = {
|
2023-11-10 12:11:49 +05:30
|
|
|
|
output: process.env.DOCKER_OUTPUT ? 'standalone' : undefined,
|
2023-07-26 18:52:53 +10:00
|
|
|
|
experimental: {
|
2023-11-14 07:38:14 +05:30
|
|
|
|
outputFileTracingRoot: path.join(__dirname, '../../'),
|
2024-04-10 17:38:34 +07:00
|
|
|
|
serverComponentsExternalPackages: ['@node-rs/bcrypt', '@documenso/pdf-sign', 'playwright'],
|
2023-11-30 08:46:33 +01:00
|
|
|
|
serverActions: {
|
2023-12-02 09:38:24 +11:00
|
|
|
|
bodySizeLimit: '50mb',
|
2023-11-30 08:46:33 +01:00
|
|
|
|
},
|
2024-07-26 14:56:42 +10:00
|
|
|
|
swcPlugins: [['@lingui/swc-plugin', {}]],
|
2023-07-26 18:52:53 +10:00
|
|
|
|
},
|
2022-11-14 23:12:51 +01:00
|
|
|
|
reactStrictMode: true,
|
2023-07-26 18:52:53 +10:00
|
|
|
|
transpilePackages: [
|
2023-11-24 16:17:54 +11:00
|
|
|
|
'@documenso/assets',
|
|
|
|
|
|
'@documenso/ee',
|
2023-07-26 18:52:53 +10:00
|
|
|
|
'@documenso/lib',
|
|
|
|
|
|
'@documenso/prisma',
|
2023-11-24 16:17:54 +11:00
|
|
|
|
'@documenso/tailwind-config',
|
2023-07-26 18:52:53 +10:00
|
|
|
|
'@documenso/trpc',
|
|
|
|
|
|
'@documenso/ui',
|
|
|
|
|
|
],
|
2023-09-20 13:48:30 +10:00
|
|
|
|
env: {
|
|
|
|
|
|
APP_VERSION: version,
|
|
|
|
|
|
NEXT_PUBLIC_PROJECT: 'web',
|
2023-11-24 16:17:54 +11:00
|
|
|
|
FONT_CAVEAT_URI: `data:font/ttf;base64,${FONT_CAVEAT_BYTES.toString('base64')}`,
|
2024-05-23 13:07:37 +10:00
|
|
|
|
FONT_NOTO_SANS_URI: `data:font/ttf;base64,${FONT_NOTO_SANS_BYTES.toString('base64')}`,
|
2023-09-20 13:48:30 +10:00
|
|
|
|
},
|
2023-07-26 18:52:53 +10:00
|
|
|
|
modularizeImports: {
|
|
|
|
|
|
'lucide-react': {
|
|
|
|
|
|
transform: 'lucide-react/dist/esm/icons/{{ kebabCase member }}',
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2023-10-18 17:03:02 +05:30
|
|
|
|
webpack: (config, { isServer }) => {
|
|
|
|
|
|
// fixes: Module not found: Can’t resolve ‘../build/Release/canvas.node’
|
|
|
|
|
|
if (isServer) {
|
|
|
|
|
|
config.resolve.alias.canvas = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-07-26 14:56:42 +10:00
|
|
|
|
config.module.rules.push({
|
|
|
|
|
|
test: /\.po$/,
|
|
|
|
|
|
use: {
|
|
|
|
|
|
loader: '@lingui/loader',
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2023-10-18 17:03:02 +05:30
|
|
|
|
return config;
|
|
|
|
|
|
},
|
2023-09-28 12:56:53 +10:00
|
|
|
|
async rewrites() {
|
|
|
|
|
|
return [
|
|
|
|
|
|
{
|
|
|
|
|
|
source: '/ingest/:path*',
|
|
|
|
|
|
destination: 'https://eu.posthog.com/:path*',
|
|
|
|
|
|
},
|
|
|
|
|
|
];
|
|
|
|
|
|
},
|
2023-10-17 13:50:54 +11:00
|
|
|
|
async redirects() {
|
|
|
|
|
|
return [
|
|
|
|
|
|
{
|
|
|
|
|
|
permanent: true,
|
|
|
|
|
|
source: '/documents/:id/sign',
|
|
|
|
|
|
destination: '/sign/:token',
|
|
|
|
|
|
has: [
|
|
|
|
|
|
{
|
|
|
|
|
|
type: 'query',
|
|
|
|
|
|
key: 'token',
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
permanent: true,
|
|
|
|
|
|
source: '/documents/:id/signed',
|
|
|
|
|
|
destination: '/sign/:token',
|
|
|
|
|
|
has: [
|
|
|
|
|
|
{
|
|
|
|
|
|
type: 'query',
|
|
|
|
|
|
key: 'token',
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
|
|
|
|
|
},
|
|
|
|
|
|
];
|
|
|
|
|
|
},
|
2022-11-24 12:21:45 +01:00
|
|
|
|
};
|
2022-11-14 23:12:51 +01:00
|
|
|
|
|
2024-04-03 15:32:34 +08:00
|
|
|
|
module.exports = withAxiom(config);
|