vue.config.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. 'use strict'
  2. const path = require('path')
  3. // const defaultSettings = require('./src/settings.js')
  4. function resolve(dir) {
  5. return path.join(__dirname, dir)
  6. }
  7. const port = process.env.port || process.env.npm_config_port || 9528
  8. module.exports = {
  9. publicPath: './',
  10. outputDir: 'dist',
  11. assetsDir: 'static',
  12. lintOnSave: process.env.NODE_ENV === 'development',
  13. productionSourceMap: false,
  14. devServer: {
  15. port: port,
  16. open: true,
  17. overlay: {
  18. warnings: false,
  19. errors: false
  20. },
  21. proxy: {
  22. '/admin': {
  23. // target: 'http://120.24.85.77:8087', // 正式环境
  24. // target: 'http://192.168.0.83:8075' // 伟玉本地环境
  25. target: 'http://120.25.146.52:8075' // 测试环境
  26. },
  27. '/node-upload': {
  28. target: 'http://vrhouse2.4dkankan.com',
  29. },
  30. }
  31. // before: require('./mock/mock-server.js')
  32. },
  33. configureWebpack: {
  34. // provide the app's title in webpack's name field, so that
  35. // it can be accessed in index.html to inject the correct title.
  36. name: '好玩展-管理后台',
  37. resolve: {
  38. alias: {
  39. '@': resolve('src'),
  40. 'api': resolve('src/api'),
  41. 'libs': resolve('src/libs'),
  42. 'vue$': 'vue/dist/vue.esm.js',
  43. // 定义静态资源快捷路径
  44. 'assets': resolve('src/assets'),
  45. // 定义组建模块快捷路径
  46. 'components': resolve('src/components'),
  47. // 定义配置模块快捷路径
  48. 'config': resolve('src/config'),
  49. // 定义指令模块快捷路径
  50. 'directive': resolve('src/directive'),
  51. // 定义骨架模块快捷路径
  52. 'layout': resolve('src/layout'),
  53. // 定义插件模块快捷路径
  54. 'plugin': resolve('src/plugin'),
  55. // 定义注册模块快捷路径
  56. 'register': resolve('src/register'),
  57. // 定义路由模块快捷路径
  58. 'router': resolve('src/router'),
  59. // 定义仓库模块快捷路径
  60. 'store': resolve('src/store'),
  61. // 定义视图模块快捷路径
  62. 'views': resolve('src/views')
  63. }
  64. }
  65. },
  66. css: {
  67. loaderOptions: {
  68. // 给 less-loader 传递 Less.js 相关选项
  69. less: {
  70. javascriptEnabled: true
  71. }
  72. }
  73. }
  74. }