vue.config.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. const path = require('path')
  2. const name = 'wanda-adm'
  3. const devServerPort = 28888
  4. const stageServerPort = 28889
  5. module.exports = {
  6. // TODO: Remember to change publicPath to fit your need
  7. publicPath: process.env.NODE_ENV === 'production' ? '/wanda-adm/' : '/',
  8. lintOnSave: process.env.NODE_ENV === 'development',
  9. productionSourceMap: false,
  10. devServer: {
  11. port: devServerPort,
  12. open: true,
  13. overlay: {
  14. warning: false,
  15. errors: true
  16. },
  17. progress: false,
  18. proxy: {
  19. [process.env.VUE_APP_BASE_API]: {
  20. target: `http://127.0.0.1:${stageServerPort}/mock-api/v1`,
  21. changeOrigin: true, // needed for virtual hosted sites
  22. ws: true, // proxy websockets
  23. pathRewrite: {
  24. ['^' + process.env.VUE_APP_BASE_API]: ''
  25. }
  26. }
  27. }
  28. },
  29. pluginOptions: {
  30. 'style-resources-loader': {
  31. preProcessor: 'scss',
  32. patterns: [
  33. path.resolve(__dirname, 'src/styles/_variables.scss'),
  34. path.resolve(__dirname, 'src/styles/_mixins.scss')
  35. ]
  36. }
  37. },
  38. chainWebpack(config) {
  39. // provide the app's title in html-webpack-plugin's options list so that
  40. // it can be accessed in index.html to inject the correct title.
  41. // https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-plugin
  42. config.plugin('html').tap(args => {
  43. args[0].title = name
  44. return args
  45. })
  46. }
  47. }