-
Notifications
You must be signed in to change notification settings - Fork 0
/
fuse.ts
44 lines (42 loc) · 999 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
import { fusebox, sparky } from 'fuse-box'
class Context {
isProduction
runServer
getConfig = () =>
fusebox({
output: "dist/$name-$hash",
target: 'browser',
entry: 'src/index.tsx',
dependencies: { include: ["tslib"] },
webIndex: {
template: 'src/index.html',
},
cache: {
enabled: true,
FTL: true,
root: ".cache"
},
watch: true,
devServer: this.runServer?{open:true}:false,
})
}
const { task, rm, exec } = sparky<Context>(Context)
task('default', async ctx => {
ctx.runServer = true
const fuse = ctx.getConfig()
await fuse.runDev()
})
task('preview', async ctx => {
rm('./dist')
ctx.runServer = true
ctx.isProduction = true
const fuse = ctx.getConfig()
await fuse.runProd({ uglify: false })
})
task('dist', async ctx => {
rm('./dist')
ctx.runServer = false
ctx.isProduction = true
const fuse = ctx.getConfig()
await fuse.runProd({ uglify: false, manifest:true })
})