forked from E-Health/fred
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathesbuild.cjs
More file actions
28 lines (26 loc) · 695 Bytes
/
esbuild.cjs
File metadata and controls
28 lines (26 loc) · 695 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
27
28
// replace `process.env.${k}` when building with variables from .env file
require('dotenv').config({ override: true })
const envVars = {};
for (const k in process.env) {
envVars[`process.env.${k}`] = JSON.stringify(process.env[k]);
}
// extra defines
const extraDefines = {
'global': 'window', // https://github.com/evanw/esbuild/issues/73
}
require('esbuild').build({
entryPoints: ['./src/index.jsx'],
target: ['es6'],
bundle: true,
outfile: './public/bundle.js',
minify: false,
sourcemap: true,
loader: {
'.js': 'jsx',
'.png': 'file'
},
define: {
...envVars,
...extraDefines,
},
}).catch(() => process.exit(1))