'use strict' const path = require('path') function resolve(dir) { return path.join(__dirname, dir) } const name = process.env.VUE_APP_TITLE || '门店拜访' // 网页标题 const port = process.env.port || process.env.npm_config_port || 80 // 端口 module.exports = { // publicPath: process.env.NODE_ENV === "production" ? "/mobile/" : "/", publicPath: "/mobile/", outputDir: 'mobile', assetsDir: 'static', lintOnSave: false, productionSourceMap: false, devServer: { port: port, open: true, proxy: { [process.env.VUE_APP_BASE_API]: { target: process.env.VUE_APP_Target, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]:process.env.VUE_APP_BASE_API+'' } }, }, disableHostCheck: true }, configureWebpack: { name: name, resolve: { alias: { '@': resolve('src') } } }, chainWebpack(config) { config.plugins.delete('preload') // TODO: need test config.plugins.delete('prefetch') // TODO: need test config.when(process.env.NODE_ENV !== 'development', config => { config.optimization.runtimeChunk('single'), { from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件 to: './' //到根目录下 } } ) } }