forked from balajmarius/commit4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuse.js
More file actions
43 lines (35 loc) · 713 Bytes
/
fuse.js
File metadata and controls
43 lines (35 loc) · 713 Bytes
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
const fsbx = require('fuse-box')
// utils
const isDevelopment = process.env.NODE_ENV === 'development'
const name = isDevelopment ? 'build/bundle' : 'build/dist.min'
// plugins
const plugins = [fsbx.BabelPlugin()]
if (!isDevelopment) {
plugins.push(fsbx.UglifyJSPlugin())
}
// config
const fuse = fsbx.FuseBox.init({
homeDir: 'src',
output: 'static/$name.js',
debug: isDevelopment,
log: isDevelopment,
sourceMaps: isDevelopment,
plugins
})
// start dev server
if (isDevelopment) {
fuse.dev({
open: true,
root: 'static'
})
}
// bundle
const bundler = fuse
.bundle(name)
.instructions('>main.js')
if (isDevelopment) {
bundler
.watch('src/**')
.hmr()
}
fuse.run()