46 lines
982 B
JavaScript
46 lines
982 B
JavaScript
const path = require('path')
|
|
|
|
function resolve(dir) {
|
|
return path.join(__dirname, dir)
|
|
}
|
|
|
|
module.exports = {
|
|
publicPath: './',
|
|
devServer: {
|
|
host: '127.0.0.1',
|
|
port: 8010,
|
|
proxy: {
|
|
'/api/': {
|
|
target: 'http://127.0.0.1:8080/api',
|
|
changeOrigin: true,
|
|
pathRewrite: {
|
|
'^/api': ''
|
|
}
|
|
}
|
|
}
|
|
},
|
|
chainWebpack(config) {
|
|
config.plugins.delete('preload') // TODO: need test
|
|
config.plugins.delete('prefetch') // TODO: need test
|
|
|
|
// set svg-sprite-loader
|
|
config.module
|
|
.rule('svg')
|
|
.exclude.add(resolve('src/icons'))
|
|
.end()
|
|
config.module
|
|
.rule('icons')
|
|
.test(/\.svg$/)
|
|
.include.add(resolve('src/icons'))
|
|
.end()
|
|
.use('svg-sprite-loader')
|
|
.loader('svg-sprite-loader')
|
|
.options({
|
|
symbolId: 'icon-[name]'
|
|
})
|
|
.end()
|
|
|
|
config.when(process.env.NODE_ENV === 'development', config => config.devtool('eval-source-map'))
|
|
}
|
|
}
|