29 lines
535 B
JavaScript
29 lines
535 B
JavaScript
|
|
import { build } from 'esbuild';
|
||
|
|
import path from 'node:path';
|
||
|
|
import fs from 'node:fs';
|
||
|
|
|
||
|
|
const root = process.cwd();
|
||
|
|
|
||
|
|
const outputDir = path.join(root, 'workers/dist');
|
||
|
|
|
||
|
|
fs.mkdirSync(outputDir, { recursive: true });
|
||
|
|
|
||
|
|
await build({
|
||
|
|
entryPoints: [
|
||
|
|
path.join(root, 'workers/docx.worker.ts')
|
||
|
|
],
|
||
|
|
outfile: path.join(outputDir, 'docx.worker.mjs'),
|
||
|
|
|
||
|
|
bundle: true,
|
||
|
|
platform: 'node',
|
||
|
|
format: 'esm',
|
||
|
|
packages: 'external',
|
||
|
|
|
||
|
|
alias: {
|
||
|
|
'@': root
|
||
|
|
},
|
||
|
|
|
||
|
|
sourcemap: false
|
||
|
|
});
|
||
|
|
|
||
|
|
console.log('DOCX Worker compiled successfully');
|