1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- const path = require('path')
- function resolve(dir) {
- return path.join(__dirname, dir);
- }
- // 基本结构
- module.exports = {
- // 打包后路径错误导致的空白页面问题。
- publicPath: '/vuefiv/',
- 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://wx.ewoogi.com/api',
- ws: false,
- changeOrigin: true,
- pathRewrite: {
- '^./': './'
- }
- }
- },
- public: 'localhost:8080/vuefiv/'
- }
- }
|