const CompressionPlugin = require('compression-webpack-plugin') module.exports = { devServer: { port: 8090, proxy: { '/data': { // target: 'http://60.205.177.43', target: 'http://10.199.143.126', // target: 'http://192.168.200.11:9003', //yll // target: 'http://localhost:6040/data/', changeOrigin: true, secure: false, pathRewrite: { '^/data': '/data', }, }, // // 工程信息化服务 // '/data': { // target: 'http://192.168.200.87:9003', // changeOrigin: true, // secure: false, // pathRewrite: { // '^/data': '', // }, // }, // 万达蜂鸟服务 '/wdfn': { target: 'http://map.wanda.cn', changeOrigin: true, pathRewrite: { '^/wdfn': '/editor', }, }, // 图例库服务 '/serve': { // target: 'http://192.168.200.87:8088', target: 'http://60.205.177.43:8080', changeOrigin: true, pathRewrite: { '^/serve': '', }, }, '/version': { target: 'http://mapapp.wanda.cn/', changeOrigin: true, pathRewrite: { '^/version': '/sgmap/mapversion', }, }, }, hot: true, // 关闭esline overlay: { warnings: false, errors: false, }, }, chainWebpack: (config) => { const svgRule = config.module.rule('svg') svgRule.uses.clear() svgRule .use('babel-loader') .loader('babel-loader') .end() .use('vue-svg-loader') .loader('vue-svg-loader') config.output.filename('static/js/[name].[hash].js').end() config.output.chunkFilename('static/js/[name].[hash].js').end() }, lintOnSave: false, publicPath: '/wandaBmGuide', // 打包名称 outputDir: 'wandaBmGuide', // 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录 assetsDir: 'static', transpileDependencies: [ '@saga-web', // 指定对第三方依赖包进行babel-polyfill处理 "@ant-design", "element-ui" ], productionSourceMap: false, // // CSS 相关选项 css: { // 将组件内的 CSS 提取到一个单独的 CSS 文件 (只用在生产环境中) extract: true, }, // 配置webpack configureWebpack: (config) => { return { plugins: [ // 压缩代码 new CompressionPlugin({ test: /\.js$|\.html$|.\css/, // 匹配文件名 threshold: 10240, // 对超过10k的数据压缩 deleteOriginalAssets: false, // true 不删除源文件 false 删除源文件 }), ], } }, }