forked from rixo/rollup-plugin-hot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
59 lines (54 loc) · 1.29 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 hmr from 'rollup-plugin-hot'
import postcss from 'rollup-plugin-postcss-hot'
// NOTE we're using the same instance of the HMR server to serve our multiple
// builds -- this works because they all use the same public directory, and they
// don't step on each other's toes by trying to write to the same output files
const hot = hmr({
public: 'public',
clearConsole: false,
inMemory: true,
})
const format = process.env.NOLLUP ? 'esm' : 'iife'
export default [
{
input: './src/main.js',
output: {
sourcemap: true,
format,
file: 'public/build/bundle.js',
},
// our example contains dynamic imports (because we want to test them with
// HMR!), so we need this option to be able to build to an iife
inlineDynamicImports: true,
plugins: [hot],
watch: {
clearScreen: false,
},
},
// another example
{
input: './src/stateful/main.js',
output: {
sourcemap: true,
format,
file: 'public/build/stateful.js',
},
plugins: [hot],
watch: {
clearScreen: false,
},
},
// postcss
{
input: './src/postcss/main.js',
output: {
sourcemap: true,
format,
file: 'public/build/postcss.js',
},
plugins: [postcss(), hot],
watch: {
clearScreen: false,
},
},
]