Files
n8n/packages/@n8n/expression-runtime/esbuild.config.js
alighasami 3d5eaf9445
Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

42 lines
1.1 KiB
JavaScript

// esbuild configuration for bundling runtime code
// Runtime code runs inside isolated context (isolate/worker/subprocess)
// and must be bundled as a self-contained IIFE or ESM module
const esbuild = require('esbuild');
const path = require('path');
async function build() {
const sharedOptions = {
entryPoints: [path.join(__dirname, 'src/runtime/index.ts')],
bundle: true,
minify: true,
sourcemap: true,
target: 'es2020',
platform: 'neutral', // Works in both Node.js and browser
mainFields: ['module', 'main'], // Needed for neutral platform to resolve packages
external: [], // Bundle everything (lodash, luxon)
};
// IIFE bundle for isolated-vm
await esbuild.build({
...sharedOptions,
format: 'iife',
globalName: '__n8nRuntime',
outfile: path.join(__dirname, 'dist/bundle/runtime.iife.js'),
});
// ESM bundle for Web Workers
await esbuild.build({
...sharedOptions,
format: 'esm',
outfile: path.join(__dirname, 'dist/bundle/runtime.esm.js'),
});
console.log('✅ Runtime bundles created successfully');
}
build().catch((error) => {
console.error('❌ Build failed:', error);
process.exit(1);
});