licp
2024-05-21 616a71ebbb82d6143768a17bf4ab84b860bb82e0
vue.config.js
@@ -1,17 +1,25 @@
/***
 * @Author licp lichunping@guanfang.com.cn
 * @Date 2024-05-13 10:35:46
 * @LastEditors licp lichunping@guanfang.com.cn
 * @LastEditTime 2024-05-21 14:44:16
 * @FilePath \mes-ocea-before\vue.config.js
 * @Description 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/**
 * 配置参考:
 * https://cli.vuejs.org/zh/config/
 */
// const url = 'http://192.168.2.7:9999'
const url = 'http://192.168.32.45:9999'
// const url = 'http://192.168.0.23:9999'
// const url = 'http://192.168.83.249:9999'
const url = 'https://ztms-mes.chinaztt.cn/'
// const url = 'http://localhost:9999'
//const url = 'http://192.168.32.45:9999'
// const url = 'http://ztt-gateway:9999'
const localUrl = 'http://localhost:8089'
//const localUrl = 'http://10.88.15.95:8089'
// const localUrl = 'http://10.88.15.95:8089'
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
const productionGzipExtensions = ['js', 'css']
@@ -30,26 +38,26 @@
  },
  // eslint-disable-next-line
  configureWebpack: (config) => {
    // if (process.env.NODE_ENV === 'production') {
    //   // 仅在生产环境下启用该配置
    //   return {
    //     plugins: [
    //       /*new MonacoWebpackPlugin({
    //         languages: ['javascript', 'css', 'html', 'json']
    //       }),*/
    //       new CompressionWebpackPlugin({
    //         filename: '[path].gz[query]',
    //         algorithm: 'gzip',
    //         test: new RegExp(
    //           '\\.(' + productionGzipExtensions.join('|') + ')$'
    //         ),
    //         threshold: 1024, // 只有大小大于该值的资源会被处理,当前配置为对于超过1k的数据进行处理,不足1k的可能会越压缩越大
    //         minRatio: 0.99, // 只有压缩率小于这个值的资源才会被处理
    //         deleteOriginalAssets: true // 删除原文件
    //       })
    //     ]
    //   }
    // }
    if (process.env.NODE_ENV === 'production') {
      // 仅在生产环境下启用该配置
      return {
        plugins: [
          /*new MonacoWebpackPlugin({
            languages: ['javascript', 'css', 'html', 'json']
          }),*/
          new CompressionWebpackPlugin({
            filename: '[path].gz[query]',
            algorithm: 'gzip',
            test: new RegExp(
              '\\.(' + productionGzipExtensions.join('|') + ')$'
            ),
            threshold: 1024, // 只有大小大于该值的资源会被处理,当前配置为对于超过1k的数据进行处理,不足1k的可能会越压缩越大
            minRatio: 0.99, // 只有压缩率小于这个值的资源才会被处理
            deleteOriginalAssets: true // 删除原文件
          })
        ]
      }
    }
  },
  // 配置转发代理
  devServer: {