-
Notifications
You must be signed in to change notification settings - Fork 21
/
esbuild.config.js
36 lines (32 loc) · 1.04 KB
/
esbuild.config.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
29
30
31
32
33
34
35
36
import * as esbuild from 'esbuild';
import babel from 'esbuild-plugin-babel';
const watch = process.argv[process.argv.length - 1] == '--watch';
// Custom `esbuild` configuration to enable Babel plugin for IE11-compatible transpilation
// TODO: When we decide we are happy to target ES6 and don't need Babel anymore, this file can be
// removed and the `build` task in `package.json` can be replaced with a simple command
// line invocation of `esbuild`, e.g.:
//
// esbuild app/assets/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds \
// --public-path=assets --target=es6
const config = {
bundle: true,
entryPoints: ['app/assets/javascript/application.js'],
minify: true,
outdir: 'app/assets/builds',
plugins: [
babel({
config: {
presets: ['@babel/preset-env'],
targets: '> 0.25%, not dead, IE 11'
}
})
],
publicPath: 'assets',
target: ['ie11']
};
if (watch) {
let ctx = await esbuild.context(config);
await ctx.watch();
} else {
await esbuild.build(config);
}