zoukankan      html  css  js  c++  java
  • vue 项目 打包配置

    项目目录 config/index.js

    在build里面更改

      build: {
        // Template for index.html
        index: path.resolve(__dirname, '../dist/index.html'),
    
        // Paths
        assetsRoot: path.resolve(__dirname, '../dist'),
        assetsSubDirectory: 'static',
        assetsPublicPath: './', // 改此处
    
        /**
         * Source Maps
         */
    
        productionSourceMap: true,
        // https://webpack.js.org/configuration/devtool/#production
        devtool: '#source-map',
        
        // Gzip off by default as many popular static hosts such as
        // Surge or Netlify already gzip all static assets for you.
        // Before setting to `true`, make sure to:
        // npm install --save-dev compression-webpack-plugin
        productionGzip: false,
        productionGzipExtensions: ['js', 'css'],
        
        // Run the build command with an extra argument to
        // View the bundle analyzer report after build finishes:
        // `npm run build --report`
        // Set to `true` or `false` to always turn it on or off
        bundleAnalyzerReport: process.env.npm_config_report
      }
    

      这样就 无论跑 npm run dev 还是 npm run build 都不会互相影响

  • 相关阅读:
    勾股定理
    委托应用-表单的创建和编辑
    学生成绩表(输入成绩后自动算出最高、最低、平均分)
    完美拖拽(点击回放运动轨迹)
    实心图案
    微博发布
    批量删除
    数组去重的方法
    模拟垂直滚动条
    点不到的NO
  • 原文地址:https://www.cnblogs.com/handsome-jm/p/7940864.html
Copyright © 2011-2022 走看看