描述:我想,这是调用最多的一个文件了吧(无论是dev,还是prod)
1 ‘use strict‘ 2 // Template version: 1.3.1 3 // see http://vuejs-templates.github.io/webpack for documentation. 4 ?5 const path = require(‘path‘) 6 ?7 module.exports = { 8 ?9 10 ??/**11 ???* 开发!!!12 ???*/13 ??dev: {14 15 ????// 路径16 ????assetsSubDirectory: ‘static‘,17 ????assetsPublicPath: ‘/‘,18 ????proxyTable: {},19 20 ????// 各种Dev Server设置21 ????host: ‘localhost‘, // 可以被process.env.HOST覆盖22 ????port: 8080, // 可以被process.env.PORT覆盖,如果端口正在使用,将确定一个免费的端口(如果8080已被占用,将重新开启 8081... .一直到8080+n)23 ????// 自动刷新浏览器24 ????autoOpenBrowser: true,25 ????// 错误覆盖26 ????errorOverlay: true,27 ????// 通知错误信息28 ????notifyOnErrors: true,29 ????// 轮询(减少服务器多个连接的压力)30 ????poll: true, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-31 32 33 ????/**34 ?????* Source Maps35 ?????*/36 37 ????// https://webpack.js.org/configuration/devtool/#development38 ????devtool: ‘cheap-module-eval-source-map‘,39 40 ????// If you have problems debugging vue-files in devtools,41 ????// set this to false - it *may* help42 ????// https://vue-loader.vuejs.org/en/options.html#cachebusting43 ????cacheBusting: true,44 45 ????cssSourceMap: true46 ??},47 48 ??/**49 ???* 打包!!!50 ???*/51 ??build: {52 ????// Template for index.html53 ????index: path.resolve(__dirname, ‘../dist/index.html‘),54 55 ????// 路径56 ????assetsRoot: path.resolve(__dirname, ‘../dist‘),57 ????assetsSubDirectory: ‘static‘,58 ????assetsPublicPath: ‘/‘,59 60 ????/**61 ?????* Source Maps62 ?????*/63 64 ????productionSourceMap: true,65 ????// https://webpack.js.org/configuration/devtool/#production66 ????devtool: ‘#source-map‘,67 68 ????//默认情况下Gzip关闭许多流行的静态主机,例如69 ????// Surge或Netlify已经为您准备了所有静态资产。70 ????//在设置为“true”之前,请确保:71 ????// npm install --save-dev compression-webpack-plugin72 73 ????// 是否开启Gzip压缩(日常服务器传输过来的文件大部分都是经过服务器Gzip处理过的,再由客户端进行一些处理)74 ????productionGzip: false,75 ????// Gzip压缩文件76 ????productionGzipExtensions: [‘js‘, ‘css‘],77 78 ????//运行带有额外参数的build命令79 ????//在构建完成后查看捆绑分析器报告:80 ????//`npm run build --report`81 ????//设置为“true”或“false”以始终打开或关闭它82 ????bundleAnalyzerReport: process.env.npm_config_report83 ??}84 }
vue - config(index.js)
原文地址:https://www.cnblogs.com/cisum/p/9612602.html