1. 程式人生 > >vue-cli webpack config index.js 配置註釋

vue-cli webpack config index.js 配置註釋

for use 輸入 域名 pack set com map webp

var path = require(‘path‘)
  
  module.exports = {
    build: { // production 環境
      env: require(‘./prod.env‘), // 使用 config/prod.env.js 中定義的編譯環境
      index: path.resolve(__dirname, ‘../dist/index.html‘), // 編譯輸入的 index.html 文件
      assetsRoot: path.resolve(__dirname, ‘../dist‘), // 編譯輸出的靜態資源路徑
      assetsSubDirectory: ‘static‘, // 編譯輸出的二級目錄
      assetsPublicPath: ‘/‘, // 編譯發布的根目錄,可配置為資源服務器域名或 CDN 域名
    productionSourceMap: true, // 是否開啟 cssSourceMap
     // 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 壓縮的文件擴展名
   },
   dev: { // dev 環境
     env: require(‘./dev.env‘), // 使用 config/dev.env.js 中定義的編譯環境
     port: 8080, // 運行測試頁面的端口
     assetsSubDirectory: ‘static‘, // 編譯輸出的二級目錄
     assetsPublicPath: ‘/‘, // 編譯發布的根目錄,可配置為資源服務器域名或 CDN 域名
     proxyTable: {}, // 需要 proxyTable 代理的接口(可跨域)
     // 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
   }
 }

vue-cli webpack config index.js 配置註釋