vue-cli3.X快速创建项目的方法步骤

2020-06-12 21:08:54易采站长站整理

设置为

true
时,
eslint-loader
会将 lint 错误输出为编译警告。默认情况下,警告仅仅会被输出到命令行,且不会使得编译失败

希望让 lint 错误在开发时直接显示在浏览器中,可以使用

lintOnSave: 'error'
。这会强制 
eslint-loader
将 lint 错误输出为编译错误

webpack-dev-server 相关配置


devServer: {
open: true,//设置自动打开
port: 1880,//设置端口
proxy: {
//设置代理
      '/axios': {
        target: 'http://101.15.22.98',
        changeOrigin: true,
        secure: false, //如果是http接口,需要配置该参数
        pathRewrite: {
          '^/axios': ''
          }
        }
}
}
}


module.exports = {
// 部署应用时的基本 URL
publicPath: process.env.NODE_ENV === 'production' ? '192.168.60.110:8080' : '192.168.60.110:8080',

// build时构建文件的目录 构建时传入 --no-clean 可关闭该行为
outputDir: 'dist',

// build时放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录
assetsDir: '',

// 指定生成的 index.html 的输出路径 (相对于 outputDir)。也可以是一个绝对路径。
indexPath: 'index.html',

// 默认在生成的静态资源文件名中包含hash以控制缓存
filenameHashing: true,

// 构建多页面应用,页面的配置
pages: {
index: {
// page 的入口
entry: 'src/index/main.js',
// 模板来源
template: 'public/index.html',
// 在 dist/index.html 的输出
filename: 'index.html',
// 当使用 title 选项时,
// template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
title: 'Index Page',
// 在这个页面中包含的块,默认情况下会包含
// 提取出来的通用 chunk 和 vendor chunk。
chunks: ['chunk-vendors', 'chunk-common', 'index'] },
// 当使用只有入口的字符串格式时,
// 模板会被推导为 `public/subpage.html`
// 并且如果找不到的话,就回退到 `public/index.html`。
// 输出文件名会被推导为 `subpage.html`。
subpage: 'src/subpage/main.js'
},

// 是否在开发环境下通过 eslint-loader 在每次保存时 lint 代码 (在生产构建时禁用 eslint-loader)
lintOnSave: process.env.NODE_ENV !== 'production',

// 是否使用包含运行时编译器的 Vue 构建版本