zoukankan      html  css  js  c++  java
  • vuejs2+webpack2+vuxui2多页面架手脚,支持二级目录

    const UglifyJsPlugin = require('uglifyjs-webpack-plugin') // 去console插件
    const CompressionWebpackPlugin = require('compression-webpack-plugin') // gzip压缩插件
    
    module.exports = {
      baseUrl: '/', // 基本路径
      outputDir: 'dist', // 输出文件目录
      assetsDir: 'tje/assets/vue',
      runtimeCompiler: true,
      productionSourceMap: true, // 是否在构建生产包时生成 sourceMap 文件,false将提高构建速度
      lintOnSave: undefined,
      devServer: {
        open: process.platform === 'darwin',
        host: '0.0.0.0',
        port: 8181,
        https: false,
        hotOnly: false,
        proxy: {
          // '/': {
          //   // 测试环境模拟服务器
          //   target: 'http://localhost:8183',
          //   ws: false,
          //   changeOrigin: true
          // }
          '/': {
            // 本地mock服务器
            target: 'http://localhost:8182',
            changeOrigin: true,
            ws: false
          }
          // '/': {
          // '/': { // jsp本地开发环境(要先登陆一下本地环境,以获取cookie)
    
          //   target: 'http://localhost:8080',
          //   changeOrigin: true,
          //   ws: false
          // }
        }, // 设置代理
        before: app => {}
      },
      // 第三方插件配置
      pluginOptions: {},
      chainWebpack: () => {},
      configureWebpack: config => {
        let plugins = [
          new UglifyJsPlugin({
            uglifyOptions: {
              compress: {
                warnings: false,
                drop_debugger: true,
                drop_console: false
              }
            },
            sourceMap: false,
            parallel: true
          }),
          new CompressionWebpackPlugin({
            filename: '[path].gz[query]',
            algorithm: 'gzip',
            test: new RegExp('\.(' + ['js', 'css'].join('|') + ')$'),
            threshold: 10240,
            minRatio: 0.8
          })
        ]
        if (process.env.NODE_ENV !== 'development') {
          config.plugins = [...config.plugins, ...plugins]
        }
      }
    }
  • 相关阅读:
    记下mongoose(转载)
    vue vue-cli中引入全局less变量的方式
    单标签不支持 伪元素
    删除tppabs,href="javascript:if(confirm)...",、/*tpa=http://...
    系统字体放大导致rem布局错乱,解决方案,已通过测试
    IE条件注释
    hbase部署经验与坑总结
    ubuntu安装mysql 5.7
    静态代理和动态代理
    单例模式
  • 原文地址:https://www.cnblogs.com/LO-ME/p/7900988.html
Copyright © 2011-2022 走看看