-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathworker.build.js
28 lines (25 loc) · 950 Bytes
/
worker.build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const alias = require('esbuild-plugin-alias');
const { NodeModulesPolyfillPlugin } = require('@esbuild-plugins/node-modules-polyfill');
// "build:worker": "esbuild --define:process.env.NODE_ENV='\"production\"' --minify --bundle --sourcemap --outdir=dist ./worker",
// "dev:worker": "esbuild --define:process.env.NODE_ENV='\"development\"' --bundle --sourcemap --outdir=dist ./worker",
const isProd = process.env.NODE_ENV === 'production'
require('esbuild')
.build({
entryPoints: ['./worker'],
bundle: true,
sourcemap: true,
minify: isProd,
outdir: 'dist',
inject: ['./process-shim.js'],
define: {
__dirname: JSON.stringify(__dirname),
"process.env.NODE_ENV": `"${process.env.NODE_ENV ?? 'development'}"`,
},
plugins: [
NodeModulesPolyfillPlugin(),
alias({
'@prisma/client': require.resolve('@prisma/client'),
}),
],
})
.catch(() => process.exit(1));