-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
47 lines (43 loc) · 938 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
37
38
39
40
41
42
43
44
45
46
47
import terser from '@rollup/plugin-terser'
import { chromeExtension, simpleReloader } from 'rollup-plugin-chrome-extension'
import copy from 'rollup-plugin-copy'
import css from 'rollup-plugin-import-css'
import svg from 'rollup-plugin-svg-import'
const isProd = process.env.NODE_ENV !== 'development'
const builds = [{
input: 'src/extension.js',
output: {
file: 'dist/script.js',
format: 'esm'
},
plugins: [
copy({
targets: [
{ src: 'src/manifest.json', dest: 'dist' },
{ src: 'src/public', dest: 'dist', deep: true }
]
}),
svg({
stringify: true
}),
css({
output: 'style.css',
minify: isProd
}),
isProd && terser()
]
}]
if (!isProd) {
builds.push({
input: 'dist/manifest.json',
output: {
dir: 'dev',
format: 'esm'
},
plugins: [
chromeExtension(),
simpleReloader()
]
})
}
export default builds