| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- 'use strict'
- // Template version: 1.3.1
- // see http://vuejs-templates.github.io/webpack for documentation.
- // Node.js 提供的關於路徑的api
- const path = require('path')
- module.exports = {
- dev: {
- // Paths
- assetsSubDirectory: 'static', // 存取asset的資料夾路徑
- assetsPublicPath: '/', // 存取asset的公開路徑
- proxyTable: {}, // proxy相關 還不清楚。中间件本质上是在本地开了一个服务器dev-server,所有的请求都通过这里转发出去,即把浏览器的发送请求代理转发到代理服务器上,再由代理服务器发送请求给目标服务器,从而解决跨域问题
- // Various Dev Server settings
- host: '10.1.1.205', // 會復值給process.env.HOST
- port: 443, // 會復值給process.env.PORT, if port is in use, a free one will be determined
- autoOpenBrowser: false,
- errorOverlay: true,
- notifyOnErrors: true,
- poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
- // 使用Eslint Loader?
- // If true, 打包的時候程式碼會被lint
- // 而且console會顯示警告被lint的地方
- useEslint: true,
- // If true, lint的錯誤會造成無法打包
- // 而且錯誤訊息會顯示在瀏覽器上
- showEslintErrorsInOverlay: false,
- /**
- * Source Maps
- */
- // Webpack Source Maps 工具模式
- // 可餐考 https://webpack.js.org/configuration/devtool/#development
- devtool: 'cheap-module-eval-source-map',
- // If you have problems debugging vue-files in devtools,
- // set this to false - it *may* help
- // https://vue-loader.vuejs.org/en/options.html#cachebusting
- cacheBusting: true,
- cssSourceMap: true
- },
- build: {
- // resolve這個方法會將第一個引數(絕對的源路徑)和後面的引數合成,後面的路徑是相對路徑(相對於前面的源路徑)
- // __dirname是node.js提供的變數,理面的值是這個檔案所在的資料夾位置
- // index 是index.html所在的位置
- index: path.resolve(__dirname, '../dist/index.html'),
- // Paths
- assetsRoot: path.resolve(__dirname, '../dist'), // 發佈後的asset的root資料夾
- assetsSubDirectory: 'static',
- assetsPublicPath: '/post/',
- /**
- * Source Maps
- */
- // If true, 發佈會含有source map
- productionSourceMap: true,
- // Webpack Source Maps 工具模式
- // 可餐考 https://webpack.js.org/configuration/devtool/#development
- devtool: '#source-map',
- // 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,
- productionGzipExtensions: ['js', 'css'],
- // 可以借由下面的指令查看發佈後各個bundle的大小及關係
- // `npm run build --report`
- bundleAnalyzerReport: process.env.npm_config_report
- }
- }
|