【webpack】config/index.js


 

// see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path')

module.exports = {
  build: {// 構建產品時使用的配置
    env: require('./prod.env'),// webpack的編譯環境
    index: path.resolve(__dirname, '../dist/index.html'),// 編譯輸入的index.html文件
    assetsRoot: path.resolve(__dirname, '../dist'),// webpack輸出的目標文件夾路徑
    assetsSubDirectory: 'static',// webpack編譯輸出的二級文件夾
    assetsPublicPath: '/',// webpack編譯輸出的發布路徑
    productionSourceMap: true,// 使用SourceMap // 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,// 默認不打開開啟gzip模式
    productionGzipExtensions: ['js', 'css'],// gzip模式下需要壓縮的文件的擴展名
    port: 9000
  },
  dev: {// 開發過程中使用的配置
    env: require('./dev.env'),// webpack的編譯環境
    port: 8080,// dev-server監聽的端口
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {},// 請求代理表,在這里可以配置特定的請求代理到對應的API接口 // CSS Sourcemaps off by default because relative paths are "buggy"
    // with this option, according to the CSS-Loader README
    // (https://github.com/webpack/css-loader#sourcemaps)
    // In our experience, they generally work as expected,
    // just be aware of this issue when enabling this option.
    cssSourceMap: false  // 是否開啟 cssSourceMap
  }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM