mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
We were previously omitting cmaps meaning that when signing documents with certain UTF-8 characters or CJK characters they would appear as outlined squares in the pdf viewer despite the actual pdf looking as expected with the characters displaying correctly.
108 lines
2.7 KiB
TypeScript
108 lines
2.7 KiB
TypeScript
import { lingui } from '@lingui/vite-plugin';
|
|
import { reactRouter } from '@react-router/dev/vite';
|
|
import autoprefixer from 'autoprefixer';
|
|
import serverAdapter from 'hono-react-router-adapter/vite';
|
|
import { createRequire } from 'node:module';
|
|
import path from 'node:path';
|
|
import tailwindcss from 'tailwindcss';
|
|
import { defineConfig, normalizePath } from 'vite';
|
|
import macrosPlugin from 'vite-plugin-babel-macros';
|
|
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
|
|
const require = createRequire(import.meta.url);
|
|
|
|
const pdfjsDistPath = path.dirname(require.resolve('pdfjs-dist/package.json'));
|
|
const cMapsDir = normalizePath(path.join(pdfjsDistPath, 'cmaps'));
|
|
|
|
/**
|
|
* Note: We load the env variables externally so we can have runtime enviroment variables
|
|
* for docker.
|
|
*
|
|
* Do not configure any envs here.
|
|
*/
|
|
export default defineConfig({
|
|
css: {
|
|
postcss: {
|
|
plugins: [tailwindcss, autoprefixer],
|
|
},
|
|
},
|
|
server: {
|
|
port: parseInt(process.env.PORT || '3000', 10),
|
|
strictPort: true,
|
|
},
|
|
plugins: [
|
|
viteStaticCopy({
|
|
targets: [
|
|
{
|
|
src: cMapsDir,
|
|
dest: 'static',
|
|
},
|
|
],
|
|
}),
|
|
reactRouter(),
|
|
macrosPlugin(),
|
|
lingui(),
|
|
tsconfigPaths(),
|
|
serverAdapter({
|
|
entry: 'server/router.ts',
|
|
}),
|
|
],
|
|
ssr: {
|
|
noExternal: ['react-dropzone', 'plausible-tracker', 'pdfjs-dist'],
|
|
external: [
|
|
'@node-rs/bcrypt',
|
|
'@prisma/client',
|
|
'@documenso/tailwind-config',
|
|
'playwright',
|
|
'playwright-core',
|
|
'@playwright/browser-chromium',
|
|
],
|
|
},
|
|
optimizeDeps: {
|
|
entries: ['./app/**/*', '../../packages/ui/**/*', '../../packages/lib/**/*'],
|
|
include: ['prop-types', 'file-selector', 'attr-accept'],
|
|
exclude: [
|
|
'node_modules',
|
|
'@node-rs/bcrypt',
|
|
'@documenso/pdf-sign',
|
|
'sharp',
|
|
'playwright',
|
|
'playwright-core',
|
|
'@playwright/browser-chromium',
|
|
],
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
https: 'node:https',
|
|
'.prisma/client/default': path.resolve(
|
|
__dirname,
|
|
'../../node_modules/.prisma/client/default.js',
|
|
),
|
|
'.prisma/client/index-browser': path.resolve(
|
|
__dirname,
|
|
'../../node_modules/.prisma/client/index-browser.js',
|
|
),
|
|
canvas: path.resolve(__dirname, './app/types/empty-module.ts'),
|
|
},
|
|
},
|
|
/**
|
|
* Note: Re run rollup again to build the server afterwards.
|
|
*
|
|
* See rollup.config.mjs which is used for that.
|
|
*/
|
|
build: {
|
|
rollupOptions: {
|
|
external: [
|
|
'@node-rs/bcrypt',
|
|
'@documenso/pdf-sign',
|
|
'@aws-sdk/cloudfront-signer',
|
|
'nodemailer',
|
|
/playwright/,
|
|
'@playwright/browser-chromium',
|
|
'skia-canvas',
|
|
],
|
|
},
|
|
},
|
|
});
|