77 lines
2.2 KiB
JavaScript
77 lines
2.2 KiB
JavaScript
'use strict'
|
|
const path = require('path')
|
|
// const port = process.env.port || process.env.npm_config_port || 9527 // dev port
|
|
const port = 9527 // dev port
|
|
const publicPath = process.env.NODE_ENV === 'production' ? "http://" + process.env.VUE_APP_HOST : '/';
|
|
console.log(port)
|
|
module.exports = {
|
|
publicPath: '/',
|
|
// port:9527,
|
|
outputDir: 'dist',
|
|
assetsDir: 'static',
|
|
lintOnSave: process.env.NODE_ENV === 'development',
|
|
productionSourceMap: false,
|
|
devServer: {
|
|
port: port,
|
|
open: true,
|
|
overlay: {
|
|
warnings: false,
|
|
errors: true
|
|
},
|
|
// before: require('./mock/mock-server.js'),
|
|
proxy: {
|
|
"/mock": {
|
|
target: "http:/127.0.0.1:8888/",
|
|
changeOrigin: true,
|
|
pathRewrite: {
|
|
// "^/mock": "/mock"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
css: {
|
|
sourceMap: true
|
|
},
|
|
transpileDependencies: ['common'],
|
|
chainWebpack: config => {
|
|
config.plugin('html')
|
|
.tap((args) => {
|
|
args[0].title = 'qiankun-example'
|
|
return args
|
|
})
|
|
const fontRule = config.module.rule('fonts')
|
|
fontRule.uses.clear()
|
|
fontRule
|
|
.use('file-loader')
|
|
.loader('file-loader')
|
|
.options({
|
|
name: 'dist/fonts/[name].[hash:7].[ext]',
|
|
publicPath,
|
|
})
|
|
.end()
|
|
config.module
|
|
.rule("svg")
|
|
.exclude.add(path.join(__dirname,"src/asset/icons/svg"))
|
|
.end()
|
|
.use('svg-sprite')
|
|
.loader("svg-sprite-loader")
|
|
.options({
|
|
symbolId:"icon-[name]"
|
|
})
|
|
.end()
|
|
// config.module
|
|
// .rule("fonts")
|
|
// .test(/.(ttf|otf|eot|woff|woff2)$/)
|
|
// .use("url-loader")
|
|
// .loader("url-loader")
|
|
// .tap(options => {
|
|
// options = {
|
|
// // limit: 10000,
|
|
// name: '/static/fonts/[name].[ext]',
|
|
// }
|
|
// return options
|
|
// })
|
|
// .end()
|
|
}
|
|
}
|