-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathfuse.js
56 lines (51 loc) · 1.26 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
52
53
54
55
56
const { Sparky, FuseBox, WebIndexPlugin, QuantumPlugin } = require("fuse-box");
const fs = require("fs")
let isProduction = false
if (process.env.NODE_ENV === "production") {
isProduction = true
}
Sparky.context(class {
getConfig() {
return FuseBox.init({
homeDir: "src",
// globals: { MeshSpin: "MeshSpin"},
debug: true,
target: "browser@es6",
output: "dist/$name.js",
useTypescriptCompiler: true,
plugins: [
WebIndexPlugin({
template: "src/index.html"
}),
isProduction && QuantumPlugin({
target: "npm-browser",
treeshake: true,
uglify: true,
bakeApiIntoBundle: "meshspin.min.js",
containedAPI: true,
})
],
cache: false,
});
}
});
Sparky.task("default", async (context) => {
const fuse = context.getConfig();
fuse.dev(); // launch http server
fs.watch("./src", {
recursive: true,
}, (eventType, filename) => {
console.log(eventType)
if (filename) {
console.log(`filename provided: ${filename}`)
fuse.sendPageReload()
} else {
console.log('filename not provided')
}
})
fuse
.bundle("meshspin.min.js")
.instructions(" >index.ts ")
.watch();
await fuse.run();
});