const path = require('path') function resolve(dir) { return path.join(__dirname, dir); } // 基本结构 module.exports = { // 打包后路径错误导致的空白页面问题。 publicPath: './', outputDir: process.env.outputDir, // * 分别为生成环境和开发环境配置 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') } } }) }, // build: { // assetsPublicPath: '/vuefiv/' // } // devServer: { // proxy: { // './': { // target: 'http://124.71.174.104:80/api', // ws: false, // changeOrigin: true, // pathRewrite: { // '^/api': 'http://124.71.174.104:80/api' // } // } // } // } }