Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vue.config.js 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. const path = require('path')
  2. const resolve = dir => {
  3. return path.join(__dirname, dir)
  4. }
  5. // 项目部署基础
  6. // 默认情况下,我们假设你的应用将被部署在域的根目录下,
  7. // 例如:https://www.my-app.com/
  8. // 默认:'/'
  9. // 如果您的应用程序部署在子路径中,则需要在这指定子路径
  10. // 例如:https://www.foobar.com/my-app/
  11. // 需要将它改为'/my-app/'
  12. // iview-admin线上演示打包路径: https://file.iviewui.com/admin-dist/
  13. const BASE_URL = process.env.NODE_ENV === 'production'
  14. ? './'
  15. : '/'
  16. module.exports = {
  17. // Project deployment base
  18. // By default we assume your app will be deployed at the root of a domain,
  19. // e.g. https://www.my-app.com/
  20. // If your app is deployed at a sub-path, you will need to specify that
  21. // sub-path here. For example, if your app is deployed at
  22. // https://www.foobar.com/my-app/
  23. // then change this to '/my-app/'
  24. publicPath: BASE_URL,
  25. outputDir: "output",
  26. assetsDir: "assets",
  27. indexPath: "index.html",
  28. outputDir: process.env.NODE_ENV === "development" ? 'devdist' : 'dist1', // 不同的环境打不同包名
  29. // tweak internal webpack configuration.
  30. // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
  31. // 如果你不需要使用eslint,把lintOnSave设为false即可
  32. //lintOnSave: true,
  33. lintOnSave: false,
  34. chainWebpack: config => {
  35. config.resolve.alias
  36. .set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
  37. .set('_c', resolve('src/components'))
  38. .set('_p',resolve('public'))
  39. },
  40. // 设为false打包时不生成.map文件
  41. productionSourceMap: false,
  42. // 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
  43. devServer: { // 配置服务器
  44. port: 8181,
  45. open: false,
  46. https: false,
  47. host: 'localhost',
  48. disableHostCheck: true, //需要做一下内网穿透,代理都配置
  49. proxy: {
  50. '/resful': {
  51. // target: 'http://192.168.1.50:9666/', // 目标 API 地址
  52. target: 'http://8.134.15.95:9666/', // 目标 API 地址
  53. ws: true, // 是否代理 websockets
  54. changOrigin: true, // 跨域配置
  55. pathRewrite: {
  56. '^/resful': '/'
  57. }
  58. }
  59. }
  60. },
  61. }