forked from largezhou/admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
63 lines (56 loc) · 1.56 KB
/
vue.config.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const path = require('path')
const LiveReloadPlugin = require('webpack-livereload-plugin')
function pathResolve() {
return path.resolve(__dirname, ...arguments)
}
const inDev = process.env.NODE_ENV === 'development'
const adminFolder = `admin${inDev ? '-dev' : ''}`
module.exports = {
outputDir: pathResolve('public/', adminFolder),
publicPath: '/' + adminFolder,
lintOnSave: false,
configureWebpack: {
entry: pathResolve('resources/src/main.js'),
plugins: [
new LiveReloadPlugin(),
],
watchOptions: {
poll: (process.argv.indexOf('--poll') !== -1) ? 500 : false,
aggregateTimeout: 500,
ignored: /node_modules/,
},
},
chainWebpack(config) {
config
.plugin('html')
.tap((args) => {
const o = args[0]
o.template = pathResolve('resources/src/template/index.html')
o.filename = pathResolve(`public/${adminFolder}/index.html`)
return args
})
config.plugins.delete('copy')
config
.resolve
.alias
.set('@', pathResolve('resources/src'))
.set('@c', pathResolve('resources/src/components'))
.set('@v', pathResolve('resources/src/views'))
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(pathResolve('resources/src/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(pathResolve('resources/src/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]',
})
.end()
},
}