vue項目中config文件中的 index.js 配置


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
  autoOpenBrowser: true, // 自動打開瀏覽器
  
} }

 


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  }}


免責聲明!

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



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