const path = require('path') function resolve(dir) { return path.join(__dirname, dir); } // 基本结构 module.exports = { // 打包后路径错误导致的空白页面问题。 publicPath: '/vuefiv/', // publicPath: '/panel/', outputDir: process.env.outputDir, // assetsPublicPath: '/vuefiv/', // assetsDir: 'vuefiv', // * 分别为生成环境和开发环境配置 configureWebpack: config => { if (process.env.NODE_ENV === 'production') { // 为生产环境修改配置... config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true } else { // 为开发环境修改配置... } Object.assign(config, { externals: { 'AMap': 'AMap', 'AMapUI': 'AMapUI' }, resolve: { extensions: ['.js', '.vue', '.json'], alias: { '@': resolve('src'), '~': process.cwd(), public: resolve('public'), components: resolve('src/components'), util: resolve('src/utils'), store: resolve('src/store'), router: resolve('src/router') } }, }) }, devServer: { proxy: { // '/vuefiv/': { './': { target: 'https://qhome.usky.cn/fivapi', ws: false, changeOrigin: true, pathRewrite: { '^./': './' } } }, public: 'localhost:8080/vuefiv/' } }