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]
        }
      }
    }
  • 相关阅读:
    DataTable四个方法
    c++面向对象编程必备“良方”(转)
    函数调用约定
    AFX_IDW_PANE_FIRST(转)
    CString.Format的详细用法(转)
    ID的分配 (转)
    CString用法整理(转载)
    jquery之效果
    JS 水仙数
    CSS 文本换行
  • 原文地址:https://www.cnblogs.com/LO-ME/p/7900988.html
Copyright © 2011-2022 走看看