-
Notifications
You must be signed in to change notification settings - Fork 11
/
fuse.ts
48 lines (41 loc) · 1021 Bytes
/
fuse.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
42
43
44
45
46
47
48
// Fuse Box 4.x Config
const { execSync } = require('child_process')
import {
fusebox,
sparky,
pluginLink
} from 'fuse-box'
class Context {
isProduction:boolean;
getConfig() {
return fusebox({
entry: './src/sketch.ts',
target: 'browser',
sourceMap: !this.isProduction,
devServer: !this.isProduction,
webIndex: {template: 'src/index.html'},
resources:{resourceFolder: './', resourcePublicRoot: '/'},
//link: {resourcePublicRoot: '/'},
plugins: [
pluginLink(/\.mp3/, { useDefault: true, resourcePublicRoot: '/' })
]
})
}
}
const { task, src, exec, rm } = sparky<Context>(Context);
task('clean', async (context) => {
rm('./dist')
})
task("default", async (context) => {
await exec('clean')
const fuse = context.getConfig()
await fuse.runDev()
})
task("dist", async (context) => {
await exec('clean')
context.isProduction = true
const fuse = context.getConfig()
await fuse.runProd({
bundles: {app: 'app.js'}
})
})