forked from otothea/docker-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fuse.js
47 lines (41 loc) · 1.29 KB
/
fuse.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
const {BabelPlugin} = require('fuse-box')
const {CSSPlugin} = require('fuse-box')
const {FuseBox} = require('fuse-box')
const {JSONPlugin} = require('fuse-box')
const {SassPlugin} = require('fuse-box')
const {WebIndexPlugin} = require('fuse-box')
const ESLintPlugin = require('fuse-box-eslint-plugin')
const config = require('./config')
module.exports = production => {
const output = production ? 'dist' : 'build'
const fuse = new FuseBox({
homeDir: 'client',
sourceMaps: !production,
hash: production,
output: `${output}/$name.js`,
plugins: [
['.json', JSONPlugin()],
['.scss', SassPlugin(), CSSPlugin({outFile: `${output}/app.css`, group: 'app.css'})],
['.js', ESLintPlugin(), BabelPlugin()],
WebIndexPlugin({
title: 'Docker UI',
template: 'client/index.html'
}),
],
alias: {
stores: '~/stores',
lib: '~/lib',
},
})
const vendor = fuse.bundle('vendor').instructions('~ index.js')
const app = fuse.bundle('app').instructions('> [index.js]')
if (!production) {
fuse.dev({
port: process.env.DOCKER_UI_DEBUGGER || config.debugger || 9999,
httpServer: false,
})
vendor.hmr().watch()
app.hmr().watch()
}
return fuse
}