-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrollup-prod.config.js
58 lines (51 loc) · 1.38 KB
/
rollup-prod.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
import defaultConfig from './rollup.config.js';
import copy from 'rollup-plugin-copy';
import del from 'rollup-plugin-delete';
import license from 'rollup-plugin-license';
import terser from '@rollup/plugin-terser';
import path from 'path';
import { generateSW } from 'rollup-plugin-workbox';
import { workboxConfig } from './workbox-config.js';
import {fileURLToPath} from 'node:url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Files to remove before doing new src
const deleteConfig = {
targets: ['src/*']
};
// Extract license comments in separate file LICENSE.txt
const licenseConfig = {
thirdParty: {
output: path.join(__dirname, 'src', 'LICENSE.txt'),
includePrivate: true
}
};
// Used for minify JS
const terserConfig = {
format: {
comments: false
}
};
// Extra files to copy in src directory ./src
const copyConfig = {
targets: [
{ src: 'manifest.json', dest: 'src' },
{ src: 'version.json', dest: 'src' },
{ src: 'upgrade-browser.html', dest: 'src' },
{ src: 'assets', dest: 'src' },
{ src: 'index.html', dest: 'src' }
]
};
const config = {
...defaultConfig,
plugins: [
del(deleteConfig),
...defaultConfig.plugins,
license(licenseConfig),
terser(terserConfig),
copy(copyConfig),
generateSW(workboxConfig)
],
preserveEntrySignatures: false
};
export default config;