-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfusebox.ts
41 lines (36 loc) · 1.04 KB
/
fusebox.ts
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
import { CSSModules, CSSPlugin, FuseBox, StylusPlugin } from "fuse-box";
import { argv } from "yargs";
// Arrange yargs input
interface IBuildConfig {
watchMode: boolean;
hotModuleLoading: boolean;
devServer: boolean;
productionMode: boolean;
}
const config = {} as IBuildConfig;
config.watchMode = argv.watch || false;
config.hotModuleLoading = argv.hotModuleLoading || false;
config.devServer = argv.devServer || false;
config.productionMode = argv.productionMode || false;
// Configure build steps
const fuse = FuseBox.init({
homeDir: "src",
output: "public/dist/$name.js",
tsConfig: "./tsconfig.json",
cache: true,
sourceMaps: true,
});
let instruction = fuse.bundle("version-changer").target("browser").instructions(">./index.ts");
if (config.watchMode && !config.productionMode) {
instruction = instruction.watch();
}
if (config.hotModuleLoading && !config.productionMode) {
instruction = instruction.hmr();
}
if (config.devServer) {
fuse.dev({
open: true,
root: "public",
});
}
fuse.run();