-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuse.ts
41 lines (36 loc) · 986 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
import { fusebox, sparky, pluginSass } from 'fuse-box';
class Context {
runServer: boolean;
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
getConfig = (adds: object = {}) =>
fusebox({
target: 'browser',
entry: 'src/entry.tsx',
webIndex: {
template: 'src/assets/index.html',
},
cache: true,
devServer: this.runServer,
dependencies: {
include: ['tslib'],
},
plugins: [
pluginSass('*.scss', {
asModule: { scopeBehaviour: 'local' },
}),
],
tsConfig: './src/tsconfig.json',
...adds,
});
}
const { task } = sparky<Context>(Context);
task('default', async ctx => {
ctx.runServer = true;
const fuse = ctx.getConfig({ logging: { level: 'verbose' } });
await fuse.runDev();
});
task('dist', async ctx => {
ctx.runServer = false;
const fuse = ctx.getConfig({ sourceMap: false });
await fuse.runProd({ uglify: true });
});