-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
43 lines (40 loc) · 1.49 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
import lwc from '@lwc/rollup-plugin';
import copy from 'rollup-plugin-copy';
import serve from 'rollup-plugin-serve';
import replace from '@rollup/plugin-replace';
import { terser } from 'rollup-plugin-terser';
import livereload from 'rollup-plugin-livereload';
import del from 'rollup-plugin-delete';
const production = (process.env.NODE_ENV === 'production');
const watching = Boolean(process.env.ROLLUP_WATCH);
export default [
{
input: 'src/index.js',
output: {
sourcemap: watching,
dir: 'dist',
format: 'esm',
},
preserveEntrySignatures: false,
watch: {
clearScreen: false,
include: 'src/**'
},
plugins: [
del({ targets: 'dist/*', runOnce: true }),
lwc({sourcemap: watching}),
copy({
targets: [
{ src: 'src/index.html', dest: 'dist' },
{ src: 'src/favicon.ico', dest: 'dist/assets/icons' },
{ src: 'node_modules/@salesforce-ux/design-system/assets/styles/salesforce-lightning-design-system.min.css', dest: 'dist/assets/styles' },
],
copyOnce: true
}),
replace({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), 'preventAssignment': true }),
production && terser(),
watching && serve('dist'),
watching && livereload({ watch: 'dist', delay: 400 })
].filter(Boolean)
},
];