vue.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const { defineConfig } = require('@vue/cli-service')
  2. const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
  3. module.exports = defineConfig({
  4. configureWebpack: {
  5. plugins: [new NodePolyfillPlugin()]
  6. },
  7. transpileDependencies: true,
  8. lintOnSave: false,
  9. devServer: {
  10. historyApiFallback: true,
  11. allowedHosts: 'all',
  12. proxy: {
  13. '/api': {
  14. target: 'https://www.gmcyy.com/api/',
  15. // target: 'http://api-gmc.localhost.cc/api/',
  16. changeOrigin: true,
  17. pathRewrite: {
  18. '^/api': ''
  19. }
  20. },
  21. '/adminApi': {
  22. target: 'https://www.gmcyy.com/api/',
  23. // target: 'http://api-gmc.localhost.cc/api/',
  24. changeOrigin: true,
  25. pathRewrite: {
  26. '^/adminApi': ''
  27. }
  28. }
  29. }
  30. },
  31. css: {
  32. loaderOptions: {
  33. sass: {
  34. sassOptions: {
  35. outputStyle: 'expanded'
  36. },
  37. prependData: '@import "~@/variables.sass"'
  38. },
  39. scss: {},
  40. postcss: {
  41. postcssOptions: {
  42. plugins: [
  43. require('postcss-plugin-px2rem')({
  44. rootValue: 144,
  45. minPixelValue: 5,
  46. selectorBlackList: ['mobile-h-s']
  47. })
  48. ]
  49. }
  50. }
  51. }
  52. }
  53. })