nak/build.js

28 lines
635 B
JavaScript
Raw Normal View History

2022-02-22 10:21:47 -05:00
#!/usr/bin/env node
2022-03-05 11:21:21 -05:00
const esbuild = require('esbuild')
const alias = require('esbuild-plugin-alias')
const nodeGlobals = require('@esbuild-plugins/node-globals-polyfill').default
2022-03-09 13:14:35 -05:00
const prod = process.argv.indexOf('prod') !== -1
2022-03-05 11:21:21 -05:00
esbuild
.build({
entryPoints: ['globals.js'],
outfile: 'globals.bundle.js',
bundle: true,
plugins: [
alias({
stream: require.resolve('readable-stream')
}),
nodeGlobals({buffer: true})
],
define: {
window: 'self',
global: 'self'
2022-03-09 13:14:35 -05:00
},
sourcemap: prod ? false : 'inline',
minify: prod
2022-02-22 10:21:47 -05:00
})
2022-03-05 11:21:21 -05:00
.then(() => console.log('build success.'))