-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuse.js
51 lines (46 loc) · 1.27 KB
/
fuse.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
const {
FuseBox,
SVGPlugin,
CSSPlugin,
BabelPlugin,
QuantumPlugin,
WebIndexPlugin,
Sparky
} = require("fuse-box");
let fuse, app, vendor, isProduction;
Sparky.task("config", () => {
fuse = new FuseBox({
homeDir: "src/",
sourceMaps: !isProduction,
hash: isProduction,
output: "dist/$name.js",
plugins: [
SVGPlugin(), CSSPlugin(), BabelPlugin(),
WebIndexPlugin({
template: "src/index.html",
path: "/dist"
}),
isProduction && QuantumPlugin({
removeExportsInterop: false,
uglify: true
})
]
});
// vendor
vendor = fuse.bundle("vendor").instructions("~ index.jsx")
// bundle app
app = fuse.bundle("app").instructions("> [index.jsx]")
});
Sparky.task("default", ["clean", "config"], () => {
fuse.dev();
// add dev instructions
app.watch().hmr()
return fuse.run();
});
Sparky.task("clean", () => Sparky.src("dist/").clean("dist/"));
Sparky.task("prod-env", ["clean"], () => { isProduction = true })
Sparky.task("dist", ["prod-env", "config"], () => {
// comment out to prevent dev server from running (left for the demo)
fuse.dev();
return fuse.run();
});