-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
39 lines (35 loc) · 1.15 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
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 { nodeResolve as resolveSubdirectoryImports } from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import livereload from 'rollup-plugin-livereload';
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',
},
watch: {
clearScreen: false,
include: 'src/**'
},
plugins: [
resolveSubdirectoryImports(),
lwc({ sourcemap: watching }),
replace({ "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV) }),
copy({
targets: [
{ src: 'src/index.html', dest: 'dist' },
{ src: 'src/assets', dest: 'dist' },
]
}),
production && terser(),
watching && serve('dist'),
watching && livereload({ watch: 'dist', delay: 400 })
].filter(Boolean)
};