cssSourceMap: true 的作用 原

我們項目中會寫很多樣式,但是在瀏覽器打開控制檯可能看不到這段css是在哪寫的


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: true //開啓    是否開啓 cssSourceMap默認爲false
  }
}

css

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章