-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
38 lines (36 loc) · 1013 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
import copy from 'rollup-plugin-copy'
import del from 'rollup-plugin-delete'
import { terser } from "rollup-plugin-terser";
const isProd = process.env.BUILD == 'production';
let plugnins = [];
if (isProd) {
plugnins.push(terser({ module: true }));
}
export default {
input: ['src/js/contentScript/content.js', 'src/js/background.js', 'src/js/popup.js'],
output: {
format: 'esm',
dir: 'dist'
},
plugins: [
del({ targets: 'dist/*' }),
...plugnins,
copy({
targets: [
{ src: 'src/assets', dest: 'dist' },
{ src: 'src/css', dest: 'dist' },
{ src: 'src/popup.html', dest: 'dist' },
{ src: 'src/popup-non-compatable.html', dest: 'dist' },
{ src: 'src/manifest.json',
dest: 'dist',
transform: (contents) => {
return Buffer.from(JSON.stringify({
...JSON.parse(contents.toString()),
version: process.env.npm_package_version
}))
}
}
]
})
]
};