fuliqi
2024-01-24 29c1e7eb5ac16e90d8991a86c1c071bc312ec8d9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const path = require('path')
const { name } = require('./package')
// const debug = process.env.NODE_ENV !== 'production'
module.exports = {
  publicPath: process.env.VUE_APP_PUBLICPATH,
  assetsDir: 'static',
  productionSourceMap: false,
  outputDir: 'www',
  lintOnSave:false,
  pages: {
    index: {
      entry: 'src/main.js',
      template: 'public/index.html',
      filename: 'index.html',
      chunks: ['chunk-vendors', 'chunk-common', 'index'],
      cdn: {
        css: [
          // 'https://cdn.jsdelivr.net/npm/element-ui@2.13.2/lib/theme-chalk/index.css'
        ],
        js: [
          // 'https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js',
          // 'https://cdn.jsdelivr.net/npm/vue-router@3.2.0/dist/vue-router.min.js',
          // 'https://cdn.jsdelivr.net/npm/vuex@3.5.1/dist/vuex.min.js',
          // 'https://cdn.jsdelivr.net/npm/element-ui@2.13.2/lib/index.js',
          // 'https://cdn.jsdelivr.net/npm/axios@0.19.2/dist/axios.min.js'
        ]
      }
    }
  },
  chainWebpack: config => {
    // 移除 prefetch 插件
    config.plugins.delete('prefetch')
  },
  configureWebpack: {
    output: {
      library: 'qrcode',
      libraryTarget: 'umd',
      jsonpFunction: `webpackJsonp_${name}`
    },
    // externals: {
    //   'element-ui': 'ELEMENT',
    //   vue: 'Vue',
    //   'vue-router': 'VueRouter',
    //   vuex: 'Vuex',
    //   axios: 'axios'
    // },
    resolve: {
      alias: {
        '@': path.resolve(__dirname, './src'),
        '@api': path.resolve(__dirname, './src/api'),
        vue$: 'vue/dist/vue.esm.js'
      }
    }
  },
  devServer: {
    port: 20000,
    headers: {
      'Access-Control-Allow-Origin': '*'
    },
    proxy: {
      '/api': {
        target: process.env.VUE_APP_API_BASE_URL,
        changeOrigin: true,
        ws: true,
        pathRewrite: {
          '^/api': ''
        }
      }
    }
  }
}