mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
chore: fix and optimize build
especially for vercel limited RAM (8GB)
This commit is contained in:
1 parent
6f1b17fc66
commit
d4447dfb2e
1 file changed
+21
-17
+21
-17
@@ -116,6 +116,7 @@ export default defineConfig({
|
||||
'@babel/core': fileURLToPath(new URL('./src/_empty.ts', import.meta.url)),
|
||||
'isolated-vm': fileURLToPath(new URL('./src/_empty.ts', import.meta.url)),
|
||||
'onnxruntime-node': fileURLToPath(new URL('./src/_empty.ts', import.meta.url)),
|
||||
'webcrypto-liner-shim': !process.env.VERCEL ? 'webcrypto-liner-shim' : fileURLToPath(new URL('./src/_empty.ts', import.meta.url)),
|
||||
},
|
||||
},
|
||||
define: {
|
||||
@@ -130,31 +131,34 @@ export default defineConfig({
|
||||
minify: !process.env.VERCEL,
|
||||
reportCompressedSize: !process.env.VERCEL,
|
||||
// cssMinify: false,
|
||||
modulePreload: false,
|
||||
// modulePreload: false,
|
||||
rollupOptions: {
|
||||
external: ['regex', './out/isolated_vm', 'isolated-vm', 'onnxruntime-node'],
|
||||
external: ['regex', './out/isolated_vm', 'isolated-vm', 'onnxruntime-node',
|
||||
...(process.env.VERCEL ? ['webcrypto-liner-shim'] : [])
|
||||
],
|
||||
output: {
|
||||
format: 'es',
|
||||
manualChunks: (id) => {
|
||||
// if (id.includes('monaco-editor')) return 'monaco-editor';
|
||||
if (id.includes('tesseract.js')) return 'tesseract.js';
|
||||
if (id.includes('pdfjs')) return 'pdfjs';
|
||||
if (id.includes('unicode')) return 'unicode';
|
||||
// if (id.includes('transformers')) return 'transformers';
|
||||
// if (id.includes("node_modules")) {
|
||||
// return "vendor";
|
||||
// }
|
||||
},
|
||||
sourcemapIgnoreList: (relativeSourcePath) => {
|
||||
const normalizedPath = path.normalize(relativeSourcePath);
|
||||
return normalizedPath.includes("node_modules");
|
||||
},
|
||||
// manualChunks: (id) => {
|
||||
// // if (id.includes('monaco-editor')) return 'monaco-editor';
|
||||
// if (id.includes('tesseract.js')) return 'tesseract.js';
|
||||
// if (id.includes('pdfjs')) return 'pdfjs';
|
||||
// if (id.includes('unicode')) return 'unicode';
|
||||
// // if (id.includes('transformers')) return 'transformers';
|
||||
// // if (id.includes("node_modules")) {
|
||||
// // return "vendor";
|
||||
// // }
|
||||
// },
|
||||
// sourcemapIgnoreList: (relativeSourcePath) => {
|
||||
// const normalizedPath = path.normalize(relativeSourcePath);
|
||||
// return normalizedPath.includes("node_modules");
|
||||
// },
|
||||
},
|
||||
cache: false,
|
||||
},
|
||||
},
|
||||
optimizeDeps: {
|
||||
include: ['isolated-vm', 'pdfjs-dist', 'onnxruntime-node'], // optionally specify dependency name
|
||||
include: ['isolated-vm', 'pdfjs-dist', 'onnxruntime-node',
|
||||
...(process.env.VERCEL ? ['webcrypto-liner-shim'] : [])], // optionally specify dependency name
|
||||
esbuildOptions: {
|
||||
supported: {
|
||||
'top-level-await': true,
|
||||
|
||||
Reference in new issue
Block a user