-
Notifications
You must be signed in to change notification settings - Fork 11
/
rollup.config.js
36 lines (32 loc) · 961 Bytes
/
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
import path from 'path'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import typescript from '@rollup/plugin-typescript'
import { chromeExtension, simpleReloader } from 'rollup-plugin-chrome-extension'
import { emptyDir } from 'rollup-plugin-empty-dir'
import zip from 'rollup-plugin-zip'
import replace from '@rollup/plugin-replace'
const isProduction = process.env.NODE_ENV === 'production'
export default {
input: 'src/manifest.json',
output: {
dir: 'dist',
format: 'esm',
chunkFileNames: path.join('chunks', '[name]-[hash].js'),
},
plugins: [
replace({
'process.env.NODE_ENV': isProduction
? JSON.stringify('production')
: JSON.stringify('development'),
preventAssignment: true,
}),
chromeExtension(),
simpleReloader(),
resolve(),
commonjs(),
typescript(),
emptyDir(),
isProduction && zip({ dir: 'releases' }),
],
}