vue.config.js 928 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const { defineConfig } = require('@vue/cli-service')
  2. const path = require('path')
  3. const { NODE_ENV, VUE_APP_TITLE = '字帖生成器' } = process.env
  4. const config = {
  5. transpileDependencies: false,
  6. productionSourceMap: NODE_ENV === 'production',
  7. chainWebpack: (setting) => {
  8. setting.plugin('html').tap((args) => {
  9. args[0].APP_TITLE = VUE_APP_TITLE
  10. return args
  11. })
  12. },
  13. css: {
  14. loaderOptions: {
  15. less: {
  16. lessOptions: {
  17. javascriptEnabled: true,
  18. }
  19. }
  20. }
  21. },
  22. pluginOptions: {
  23. 'style-resources-loader': {
  24. preProcessor: 'less',
  25. patterns: [
  26. path.resolve(__dirname, 'src/styles/variable.less')
  27. ]
  28. }
  29. },
  30. devServer: {
  31. open: true,
  32. port: 8081,
  33. host: 'localhost',
  34. proxy: {
  35. '/api': {
  36. target: 'https://localhost:8081',
  37. changeOrigin: true
  38. }
  39. }
  40. }
  41. }
  42. module.exports = defineConfig(config)