-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrollup.config.js
47 lines (43 loc) · 1.12 KB
/
rollup.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
37
38
39
40
41
42
43
44
45
46
47
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import replace from '@rollup/plugin-replace';
import babel from '@rollup/plugin-babel';
import { terser } from "rollup-plugin-terser";
import { chromeExtension, simpleReloader } from 'rollup-plugin-chrome-extension';
import tsconfig from './tsconfig.json';
const prod = process.env.NODE_ENV === 'production';
const dev = !prod;
export default {
input: 'src/manifest.json',
output: {
dir: 'dist',
format: 'esm',
sourcemap: dev,
},
plugins: [
// always put chromeExtension() before other plugins
chromeExtension(),
simpleReloader(),
prod && terser(),
resolve(),
typescript({
...tsconfig.compilerOptions,
sourceMap: dev,
}),
babel({
babelHelpers: 'bundled',
presets: ['@babel/preset-env', {
targets: 'Chrome > 65, not dead',
useBuiltIns: 'usage',
corejs: 3,
}]
}),
commonjs(),
replace({
__DEBUG__: dev,
__DEV__: dev,
__PROD__: prod,
})
].filter(Boolean),
}