-
Notifications
You must be signed in to change notification settings - Fork 99
/
rollup.config.js
82 lines (78 loc) · 1.93 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import { uglify } from 'rollup-plugin-uglify';
import copy from 'rollup-plugin-copy';
const production = !process.env.ROLLUP_WATCH;
const compileJSFile = (input, output) => ({
input,
output: {
format: 'iife',
file: output,
},
plugins: [resolve(), commonjs(), production && uglify()],
watch: {
clearScreen: false,
},
});
/**
* File structure in the build folder
* All the js files are uglified
* build/
* background/
* background.html
* background.js
* contentScripts/
* save.js
* update.js
* delete.js
* get.js
* images/
* (The options folder would be served via svelte later)
* options/
* options.html
* options.js
* options.css
* Roboto/
* utils/
* manifest.json
*/
export default [
compileJSFile('background.js', 'build/background.js'),
compileJSFile('contentScripts/save.js', 'build/contentScripts/save.js'),
compileJSFile('contentScripts/delete.js', 'build/contentScripts/delete.js'),
compileJSFile('contentScripts/update.js', 'build/contentScripts/update.js'),
compileJSFile('contentScripts/get.js', 'build/contentScripts/get.js'),
{
input: 'options/options.js',
output: {
format: 'iife',
file: 'build/options/options.js',
},
plugins: [
resolve(),
commonjs(),
production && uglify(),
copy({
targets: [
// The options page is supposed to be rewritten with svelte
{
src: ['options/index.html', 'options/options.css'],
dest: ['build/options'],
},
{
src: ['images', 'manifest.json', 'utils'],
dest: ['build'],
},
{
src: ['contentScripts/index.css'],
dest: ['build/contentScripts'],
},
],
verbose: true,
}),
],
watch: {
clearScreen: false,
},
},
];