vue-cli的使用與詳細介紹,能夠到github上獲取https://github.com/vuejs/vue-clicss
項目中配置的config/index.js,有dev和production兩種環境的配置 如下介紹的是production環境下的webpack配置的理解html
1 var path = require('path') 2 3 module.exports = { 4 build: { // production 環境 5 env: require('./prod.env'), // 使用 config/prod.env.js 中定義的編譯環境 6 index: path.resolve(__dirname, '../dist/index.html'), // 編譯輸入的 index.html 文件 7 assetsRoot: path.resolve(__dirname, '../dist'), // 編譯輸出的靜態資源路徑 8 assetsSubDirectory: 'static', // 編譯輸出的二級目錄 9 assetsPublicPath: '/', // 編譯發佈的根目錄,可配置爲資源服務器域名或 CDN 域名 10 productionSourceMap: true, // 是否開啓 cssSourceMap 11 // Gzip off by default as many popular static hosts such as 12 // Surge or Netlify already gzip all static assets for you. 13 // Before setting to `true`, make sure to: 14 // npm install --save-dev compression-webpack-plugin 15 productionGzip: false, // 是否開啓 gzip 16 productionGzipExtensions: ['js', 'css'] // 須要使用 gzip 壓縮的文件擴展名 17 }, 18 dev: { // dev 環境 19 env: require('./dev.env'), // 使用 config/dev.env.js 中定義的編譯環境 20 port: 8080, // 運行測試頁面的端口 21 assetsSubDirectory: 'static', // 編譯輸出的二級目錄 22 assetsPublicPath: '/', // 編譯發佈的根目錄,可配置爲資源服務器域名或 CDN 域名 23 proxyTable: {}, // 須要 proxyTable 代理的接口(可跨域) 24 // CSS Sourcemaps off by default because relative paths are "buggy" 25 // with this option, according to the CSS-Loader README 26 // (https://github.com/webpack/css-loader#sourcemaps) 27 // In our experience, they generally work as expected, 28 // just be aware of this issue when enabling this option. 29 cssSourceMap: false // 是否開啓 cssSourceMap 30 } 31 }