123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- const CompressionPlugin = require('compression-webpack-plugin')
- const TerserPlugin = require('terser-webpack-plugin')
- module.exports = {
- devServer: {
- port: 8091,
- open: true,
- // 关闭esline
- overlay: {
- warnings: false,
- errors: false,
- },
- proxy: {
- '/wdfn': {
- target: 'http://map.wanda.cn',
- changeOrigin: true,
- pathRewrite: {
- '^/wdfn': '/editor',
- },
- },
- '/serve': {
- // target: 'http://192.168.200.87:8088/',
- // target: 'http://192.168.200.83:8085/',
- target: 'http://60.205.177.43:8080', //阿里云
- changeOrigin: true,
- secure: false,
- pathRewrite: {
- '^/serve': '',
- },
- },
- '/data': {
- // target: 'http://192.168.200.87:9003',
- target: 'http://60.205.177.43:9903', //阿里云
- changeOrigin: true,
- secure: false,
- pathRewrite: {
- '^/data': '/data',
- },
- },
- },
- },
- 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')
- },
- lintOnSave: false,
- // publicPath: '/dist',
- publicPath: '/wandaTopol',
- // 打包名称
- outputDir: 'wandaTopol',
- // 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录
- assetsDir: 'static',
- productionSourceMap: false,
- // CSS 相关选项
- css: {
- // 将组件内的 CSS 提取到一个单独的 CSS 文件 (只用在生产环境中)
- extract: true,
- },
- // 配置webpack
- configureWebpack: (config) => {
- config.optimization = {
- minimize: true,
- minimizer: [
- new TerserPlugin({
- terserOptions: {
- // ecma: undefined,
- // warnings: false,
- // parse: {},
- compress: { drop_console: true },
- // mangle: true, // Note `mangle.properties` is `false` by default.
- // module: false,
- output: { comments: false },
- // toplevel: false,
- // nameCache: null,
- // ie8: false,
- // keep_classnames: undefined,
- // keep_fnames: false,
- // safari10: false,
- },
- }),
- ],
- }
- return {
- plugins: [
- // 压缩代码
- new CompressionPlugin({
- test: /\.js$|\.html$|.\css/, // 匹配文件名
- threshold: 10240, // 对超过10k的数据压缩
- deleteOriginalAssets: false, // true 不删除源文件 false 删除源文件
- }),
- ],
- }
- },
- }
|