-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
59 lines (56 loc) · 1.92 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
import lwc from '@lwc/rollup-plugin';
import fs from 'fs';
import json from '@rollup/plugin-json';
import replace from '@rollup/plugin-replace';
import { nodeResolve as resolveSubdirectoryImports } from '@rollup/plugin-node-resolve';
import copy from 'rollup-plugin-copy';
import serve from 'rollup-plugin-serve';
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 }),
resolveSubdirectoryImports(),
lwc({ sourcemap: watching, exclude: '**/*.json' }),
json(),
replace({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), 'preventAssignment': true }),
copy({
targets: [
{ src: 'src/index.html', dest: 'dist' },
{ src: 'src/favicon.ico', dest: 'dist' },
{ src: 'node_modules/@salesforce-ux/design-system/assets/styles/salesforce-lightning-design-system.min.css', dest: 'dist/assets/styles' },
],
copyOnce: true
}),
production && terser(),
watching && serve({
contentBase: 'dist',
https: {
key: fs.readFileSync('ssl.key'),
cert: fs.readFileSync('ssl.crt'),
}
}),
watching && livereload({
watch: 'dist',
delay: 400,
https: {
key: fs.readFileSync('ssl.key'),
cert: fs.readFileSync('ssl.crt'),
}
})
].filter(Boolean)
};