代码拉取完成,页面将自动刷新
const path = require('path')
const aliasConfig = require('./alias.config')
const port = process.env.port || 9000
function resolve(dir) {
return path.join(__dirname, dir)
}
const { VUE_APP_TITLE, VUE_APP_PROJECT_NAME } = process.env
function getPages() {
const pages = {
entry: 'src/main.js', // page 的入口
template: 'public/index.html', // 模板来源
filename: 'index.html', // 在 dist/index.html 的输出
// 当使用 title 选项时,
// template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
title: VUE_APP_TITLE,
// 在这个页面中包含的块,默认情况下会包含
// 提取出来的通用 chunk 和 vendor chunk。
chunks: ['chunk-vendors', 'chunk-common', 'index']
}
if (VUE_APP_PROJECT_NAME === 'default') {
return pages
} else if (VUE_APP_PROJECT_NAME === 'demo') {
return {
...pages,
entry: 'demo/main.js',
}
}
}
const CONFIG = {
pages: {
index: getPages()
},
// https://foo.github.io/bar/
// https://cli.vuejs.org/config/#publicpath
publicPath: '/',
outputDir: 'dist',
assetsDir: 'static',
lintOnSave: false,
chainWebpack: config => {
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()
},
productionSourceMap: false,
configureWebpack: {
resolve: {
alias: {
...aliasConfig.resolve.alias
}
}
},
// 本地开发代理服务器
// https://github.com/chimurai/http-proxy-middleware
devServer: {
port: port,
// open: true,
overlay: {
warnings: false,
errors: true
},
proxy: {
'^/': {
target: process.env.VUE_APP_BASE_API_PROXY_URL,
ws: false,
changeOrigin: true
}
}
}
}
module.exports = CONFIG
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。