代码拉取完成,页面将自动刷新
const path = require('path')
const CompressionPlugin = require('compression-webpack-plugin')
const pkg = require('./package.json')
const rmPdfWorkerSig = require('./rm-pdf-worker-sig.js')
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
publicPath: process.env.VUE_APP_BASEURL || '/',
productionSourceMap: false,
configureWebpack: function () {
return {
resolve: {
// extensions: ['.js', '.json'],
alias: {
'@': path.resolve(__dirname, './src'),
'views': path.resolve(__dirname, './src/views'),
}
},
externals: {
'AMap': 'AMap',
'AMapUI': 'AMapUI',
'SockJS': 'SockJS',
'Stomp': 'Stomp',
// 'Hls': 'Hls',
// 'vue': 'Vue',
// 'vue-router': 'VueRouter',
// 'vuex':'Vuex',
},
plugins: [
new CompressionPlugin({
test:/\.js$|\.html$|\.css/, //匹配文件名
threshold: 10240,//对超过10k的数据压缩
deleteOriginalAssets: false //不删除源文件
})
]
}
},
chainWebpack: function(config) {
if (pkg && pkg.version) {
config.plugin('define')
.tap(([options]) => {
options['process.env']['VUE_APP_NAME'] = `"${pkg.name}"`
options['process.env']['VUE_APP_VERSION'] = `"${pkg.version}"`
return [options]
})
config
.plugin('rmPdfWorkerSig')
.use(rmPdfWorkerSig) // 不要 new
}
config
.when(process.env.NODE_ENV !== 'development',
config => {
config
.optimization.splitChunks({
chunks: 'all',
cacheGroups: {
elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
},
vueDist: {
name: 'chunk-vue', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?(vue|vue-router|vuex)(.*)/ // in order to adapt to cnpm
}
}
})
})
},
// css: {
// loaderOptions: {
// // 给 sass-loader 传递选项
// scss: {
// // @/ 是 src/ 的别名
// // 所以这里假设你有 `src/variables.sass` 这个文件
// // 注意:在 sass-loader v7 中,这个选项名是 "data"
// prependData: `@import "~@/style/theme/common-scss/var.scss"`
// }
// }
// },
devServer: {
port: '8086',
https: false,
clientLogLevel: 'warning' ,//eslint 报错在终端显示
overlay: {
warnings: false,
errors: false
},
proxy: {
// '^/ws-register': {
// target: process.env.VUE_APP_SOCKET_URL,
// changeOrigin: true,
// onProxyReq: function(proxyReq){
// proxyReq.removeHeader('origin')
// }
// },
// 文件服务
'^/file': {
target: 'http://124.165.206.87:9000',
changeOrigin: true,
onProxyReq: function(proxyReq){
proxyReq.removeHeader('origin')
}
},
"/gis": {
target: 'http://124.165.206.87:9000',
changeOrigin: true,
onProxyReq: function(proxyReq) {
proxyReq.removeHeader("origin");
},
},
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。