-
Notifications
You must be signed in to change notification settings - Fork 220
Expand file tree
/
Copy pathrollup-boot.config.js
More file actions
39 lines (33 loc) · 1.04 KB
/
rollup-boot.config.js
File metadata and controls
39 lines (33 loc) · 1.04 KB
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
37
38
39
import { babel } from '@rollup/plugin-babel';
import json from '@rollup/plugin-json';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
const isProd = process.env.NODE_ENV === 'production';
const prodPlugins = [];
if (isProd) {
prodPlugins.push(terser());
}
export default {
input: 'src/boot/index.ts',
output: {
file: 'build/boot-template.js',
// Built as an IIFE rather than ES module because there are many existing
// <script> tags on websites that load it as a non-module script.
format: 'iife',
sourcemap: false,
},
preserveEntrySignatures: false,
treeshake: isProd,
plugins: [
babel({
// Rollup docs recommend against "inline", but for this tiny bundle it
// produces a prod bundle of the same size and dev bundle that has less cruft in it.
babelHelpers: 'inline',
exclude: 'node_modules/**',
extensions: ['.js', '.ts', '.tsx'],
}),
json(),
nodeResolve({ extensions: ['.js', '.ts', '.tsx'] }),
...prodPlugins,
],
};