vue - config(index.js)

描述:我想,这是调用最多的一个文件了吧(无论是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 Maps
35      */
36 
37     // https://webpack.js.org/configuration/devtool/#development
38     devtool: 'cheap-module-eval-source-map',
39 
40     // If you have problems debugging vue-files in devtools,
41     // set this to false - it *may* help
42     // https://vue-loader.vuejs.org/en/options.html#cachebusting
43     cacheBusting: true,
44 
45     cssSourceMap: true
46   },
47 
48   /**
49    * 打包!!!
50    */
51   build: {
52     // Template for index.html
53     index: path.resolve(__dirname, '../dist/index.html'),
54 
55     // 路径
56     assetsRoot: path.resolve(__dirname, '../dist'),
57     assetsSubDirectory: 'static',
58     assetsPublicPath: '/',
59 
60     /**
61      * Source Maps
62      */
63 
64     productionSourceMap: true,
65     // https://webpack.js.org/configuration/devtool/#production
66     devtool: '#source-map',
67 
68     //默认情况下Gzip关闭许多流行的静态主机,例如
69     // Surge或Netlify已经为您准备了所有静态资产。
70     //在设置为“true”之前,请确保:
71     // npm install --save-dev compression-webpack-plugin
72 
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_report
83   }
84 }

猜你喜欢

转载自www.cnblogs.com/cisum/p/9612602.html