vue.config.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. const { defineConfig } = require('@vue/cli-service')
  2. module.exports = defineConfig({
  3. transpileDependencies: true,
  4. configureWebpack: {
  5. output: {
  6. filename: 'js/[name].[contenthash:8].js',
  7. chunkFilename: 'js/[name].[contenthash:8].js'
  8. }
  9. },
  10. css: {
  11. extract: {
  12. filename: 'css/[name].[contenthash:8].css',
  13. chunkFilename: 'css/[name].[contenthash:8].css'
  14. }
  15. },
  16. devServer: {
  17. port: 81, //固定端口号
  18. proxy: {
  19. '/api': {
  20. target: 'http://127.0.0.1:8080', // 设置你的后端 API 地址
  21. // target: 'http://192.168.66.133:8080', // 设置你的后端 API 地址
  22. changeOrigin: true, // 允许跨域
  23. // pathRewrite: {
  24. // '^/api': '', // 重写请求路径,去掉 '/api'
  25. // },
  26. },
  27. },
  28. client: {
  29. overlay: false
  30. }
  31. }
  32. })
  33. module.exports.chainWebpack = config => {
  34. config.module
  35. .rule('xlsx')
  36. .test(/\.(xlsx)(\?.*)?$/)
  37. .use('file-loader')
  38. .loader('file-loader')
  39. .options({
  40. name: 'files/[name].[hash:8].[ext]'
  41. });
  42. };