You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vite.config.js 1.4KB

1 month ago
3 weeks ago
1 month ago
1 month ago
1 month ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import eslintPlugin from 'vite-plugin-eslint'
  4. import VueSetupExtend from 'vite-plugin-vue-setup-extend'
  5. import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
  6. import vueJsx from '@vitejs/plugin-vue-jsx'
  7. import path from 'path'
  8. // https://vitejs.dev/config/
  9. export default defineConfig(() => {
  10. return {
  11. plugins: [
  12. vue(),
  13. VueSetupExtend(),
  14. vueJsx({
  15. // options are passed on to @vue/babel-plugin-jsx
  16. }),
  17. eslintPlugin({
  18. include: ['src/**/*.js', 'src/**/*.vue', 'src/*.js', 'src/*.vue']
  19. }),
  20. createSvgIconsPlugin({
  21. // 配置路径在你的src里的svg存放文件
  22. iconDirs: [path.resolve(process.cwd(), './src/assets/icons/svgs')],
  23. // 指定symbolId格式
  24. symbolId: 'icon-[dir]-[name]'
  25. })
  26. ],
  27. resolve: {
  28. // 配置路径别名
  29. alias: {
  30. '@': path.resolve(__dirname, './src')
  31. }
  32. },
  33. build: {
  34. // target: ['es2015', 'chrome58']
  35. // rollupOptions: {
  36. // manualChunks: (id) => {
  37. // if (id.includes('node_modules')) {
  38. // return 'vendor'
  39. // }
  40. // }
  41. // }
  42. },
  43. server: {
  44. open: true,
  45. host: '0.0.0.0',
  46. proxy: {
  47. '/pm': {
  48. // 后台地址
  49. target: 'http://121.199.28.40:9089',
  50. changeOrigin: true
  51. }
  52. }
  53. }
  54. }
  55. })