1 Star 0 Fork 2

zhaogh / vue-h5-template

forked from SyncGithub / vue-h5-template 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vue.config.js 1.93 KB
一键复制 编辑 原始数据 按行查看 历史
竹知xw 提交于 2021-08-15 22:10 . eslint:修复eslint报错&&格式化
'use strict'
const path = require('path')
const { merge } = require('webpack-merge')
const tsImportPluginFactory = require('ts-import-plugin')
const config = require('./config')
function resolve(dir) {
return path.join(__dirname, dir)
}
const { mockURL } = config[process.env.NODE_ENV]
// All configuration item explanations can be find in https://cli.vuejs.org/config/
module.exports = {
publicPath: '/',
outputDir: 'dist',
assetsDir: 'static',
lintOnSave: process.env.NODE_ENV === 'development',
// https://github.com/youzan/vant/issues/5735
parallel: process.env.NODE_ENV === 'development',
devServer: {
overlay: {
warnings: false,
errors: true
},
proxy: {
'/dev-api': {
target: mockURL,
pathRewrite: {
'^/dev-api': '/'
},
secure: false,
changeOrigin: true
}
}
},
configureWebpack: {
devtool: 'source-map',
name: 'vue-h5-template',
resolve: {
alias: {
'@': resolve('src')
}
}
},
chainWebpack(config) {
// set ts-loader
config.module
.rule('ts')
.use('ts-loader')
.tap(options => {
options = merge(options, {
transpileOnly: true,
getCustomTransformers: () => ({
before: [
tsImportPluginFactory({
libraryName: 'vant',
libraryDirectory: 'es',
style: true
})
]
}),
compilerOptions: {
module: 'es2015'
}
})
return options
})
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(resolve('src/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
}
}
TypeScript
1
https://gitee.com/zhaogh-dev/vue-h5-template.git
git@gitee.com:zhaogh-dev/vue-h5-template.git
zhaogh-dev
vue-h5-template
vue-h5-template
master

搜索帮助