vue - config(index.js)
描述:我想,这是调用最多的一个文件了吧(无论是dev,还是prod)
'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation. const path = require('path') module.exports = { /**
* 开发!!!
*/
dev: { // 路径
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {}, // 各种Dev Server设置
host: 'localhost', // 可以被process.env.HOST覆盖
port: 8080, // 可以被process.env.PORT覆盖,如果端口正在使用,将确定一个免费的端口(如果8080已被占用,将重新开启 8081... .一直到8080+n)
// 自动刷新浏览器
autoOpenBrowser: true,
// 错误覆盖
errorOverlay: true,
// 通知错误信息
notifyOnErrors: true,
// 轮询(减少服务器多个连接的压力)
poll: true, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- /**
* 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: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'), // 路径
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/', /**
* Source Maps
*/ productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map', //默认情况下Gzip关闭许多流行的静态主机,例如
// Surge或Netlify已经为您准备了所有静态资产。
//在设置为“true”之前,请确保:
// npm install --save-dev compression-webpack-plugin // 是否开启Gzip压缩(日常服务器传输过来的文件大部分都是经过服务器Gzip处理过的,再由客户端进行一些处理)
productionGzip: false,
// Gzip压缩文件
productionGzipExtensions: ['js', 'css'], //运行带有额外参数的build命令
//在构建完成后查看捆绑分析器报告:
//`npm run build --report`
//设置为“true”或“false”以始终打开或关闭它
bundleAnalyzerReport: process.env.npm_config_report
}
}
vue - config(index.js)的更多相关文章
- vue -- config index.js 配置文件详解
此文章介绍vue-cli脚手架config目录下index.js配置文件 此配置文件是用来定义开发环境和生产环境中所需要的参数 关于注释 当涉及到较复杂的解释我将通过标识的方式(如(1))将解释写到单 ...
- vue中config/index.js:配置的详细理解
当我们需要和后台分离部署的时候,必须配置config/index.js: 用vue-cli 自动构建的目录里面 (环境变量及其基本变量的配置) var path = require('path') ...
- 对vue中 默认的 config/index.js:配置的详细理解 -【以及webpack配置的理解】-config配置的目的都是为了服务webpack的配置,给不同的编译条件提供配置
当我们需要和后台分离部署的时候,必须配置config/index.js: 用vue-cli 自动构建的目录里面 (环境变量及其基本变量的配置) var path = require('path') ...
- vue-cli脚手架npm相关文件解读(9)config/index.js
系列文章传送门: 1.build/webpack.base.conf.js 2.build/webpack.prod.conf.js 3.build/webpack.dev.conf.js 4.bui ...
- vue-cli下面的config/index.js注解 webpack.base.conf.js注解
config/indexjs详解上代码: 'use strict' // Template version: 1.3.1 // see http://vuejs-templates.github.io ...
- webpack / vue项目 config/index.js配置(用于配置webpack服务器代理)
'use strict' // Template version: 1.1.3 // see http://vuejs-templates.github.io/webpack for document ...
- config/index.js
// see http://vuejs-templates.github.io/webpack for documentation.var path = require('path') module. ...
- vue-cli 构建项目中 config/index.js 文件解读
// see http://vuejs-templates.github.io/webpack for documentation. var path = require('path') module ...
- 【webpack】config/index.js
// see http://vuejs-templates.github.io/webpack for documentation. var path = require('path') module ...
随机推荐
- CodeVS1169 传纸条 [DP补完计划]
题目传送门 题目描述 Description 小渊和小轩是好朋友也是同班同学,他们在一起总有谈不完的话题.一次素质拓展活动中,班上同学安排做成一个m行n列的矩阵,而小渊和小轩被安排在矩阵对角线的两端, ...
- spring boot简单入门
1.创建mave工程(jar) 2.pom文件引入依赖 <!--引入父依赖--> <parent> <groupId>org.springframework.boo ...
- CNN-感受野
CNN中感受野的计算:http://blog.csdn.net/kuaitoukid/article/details/46829355(好像有错误)http://blog.csdn.net/green ...
- CSS中包含块原理解析
CSS包含块原理解析 确定CSS中的包含块也确定就是元素的父元素.关键是:看元素是如何定位的.确定包含块很重要,比如设置百分比.另外也可以进行样式的继承等等. 分两个情况: 相对定位和静态定位 静态定 ...
- 挑战python 之一马当先(python的广搜)
下过象棋的人都知道,马只能走'日'字形(包括旋转90°的日),现在想象一下,给你一个n行m列网格棋盘, 棋盘的左下角有一匹马,请你计算至少需要几步可以将它移动到棋盘的右上角,若无法走到,则输出-1. ...
- 前m大的数
前m大的数 Time Limit: 1000 MS Memory Limit: 32768 KB 64-bit integer IO format: %I64d , %I64u Java class ...
- sg函数总结
http://blog.csdn.net/luomingjun12315/article/details/45555495 这一段时间写的题和我接下来要展示的一些概念都来自这里↑. 必胜点和必败点的概 ...
- BZOJ 2157 旅游(树链剖分+线段树)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=2157 [题目大意] 支持修改边,链上查询最大值最小值总和,以及链上求相反数 [题解] ...
- 【KMP】BZOJ3942-[Usaco2015 Feb] Censoring
[题目大意] 有一个S串和一个T串,长度均小于1,000,000,设当前串为U串,然后从前往后枚举S串一个字符一个字符往U串里添加,若U串后缀为T,则去掉这个后缀继续流程.输出最后的S串. [思路]三 ...
- mysql表相关操作
表的完整性约束 约束条件与数据类型的宽度一样,都是可选参数 作用:用于保证数据的完整性和一致性 主要分为: not null 标识该字段不能为空 default 为该字段设置默认值 unsign ...