-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuse.dev.js
63 lines (53 loc) · 1.29 KB
/
fuse.dev.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
60
61
62
63
const fs = require("fs-extra");
fs.removeSync("dist");
const TypeHelper = require('fuse-box-typechecker').TypeHelper;
const typeHelper = TypeHelper({
basePath: "./",
tsConfig: "./tsconfig.json",
tsLint: "./tslint.json"
});
const {
EnvPlugin,
FuseBox,
TypeScriptHelpers,
WebIndexPlugin,
} = require("fuse-box");
const fuse = FuseBox.init({
homeDir: "src",
useTypescriptCompiler: true,
sourceMaps: true,
target: "browser",
plugins: [
EnvPlugin({
NODE_ENV: "development"
}),
TypeScriptHelpers(),
WebIndexPlugin({
template: "src/index.html",
target: "index.html"
}),
],
output: "dist/$name.js",
});
fuse.bundle("vendor")
.instructions("~/index.tsx");
let appJsCreated = false;
fuse.bundle("app")
.instructions("!> index.tsx [index.tsx]")
.watch("**/*.(ts|tsx)")
.hmr({reload: true})
.completed(() => {
if (appJsCreated) {
console.log("\napp.js successfully updated\n");
} else {
appJsCreated = true;
console.log("\napp.js successfully created\n");
}
console.log("Running typechecker ...");
typeHelper.runSync();
});
fuse.dev({
root: "dist",
open : true,
});
fuse.run();