-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesbuild.js
More file actions
26 lines (24 loc) · 798 Bytes
/
esbuild.js
File metadata and controls
26 lines (24 loc) · 798 Bytes
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
const esbuild = require('esbuild');
const dummyResolves = /(^fs|^path)$/
esbuild
.build({
entryPoints: ['src/index.ts'],
outdir: 'dist',
bundle: true,
sourcemap: true,
minify: false, // might want to use true for production build
format: 'cjs', // needs to be CJS for now
target: ['es2020'], // don't go over es2020 because quickjs doesn't support it
// EJS tries to load node modules that aren't there at runtime (fs and path)
// this is okay we don't need them, so we'll replace them with an empty js module
plugins: [
{
name: 'stub-ejs-deps',
setup(build) {
build.onResolve({ filter: dummyResolves }, args => {
return { path: require.resolve('./src/dummy.js') }
});
},
},
],
})