vite.config.base.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { resolve } from 'path'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import vueJsx from '@vitejs/plugin-vue-jsx'
  5. import svgLoader from 'vite-svg-loader'
  6. // import vitePluginForArco from '@arco-plugins/vite-vue'
  7. export default defineConfig({
  8. // base: './', 使用electron 打包桌面程序时,修复资源文件404,需取消注释
  9. plugins: [
  10. vue(),
  11. vueJsx(),
  12. svgLoader({ svgoConfig: {} })
  13. // vitePluginForArco({
  14. // theme: '@arco-themes/vue-emcrm'
  15. // })
  16. ],
  17. resolve: {
  18. alias: [
  19. {
  20. find: '@',
  21. replacement: resolve(__dirname, '../src')
  22. },
  23. {
  24. find: 'assets',
  25. replacement: resolve(__dirname, '../src/assets')
  26. },
  27. {
  28. find: 'vue-i18n',
  29. replacement: 'vue-i18n/dist/vue-i18n.cjs.js' // Resolve the i18n warning issue
  30. },
  31. {
  32. find: 'vue',
  33. replacement: 'vue/dist/vue.esm-bundler.js' // compile template
  34. }
  35. ],
  36. extensions: ['.ts', '.js']
  37. },
  38. define: {
  39. 'process.env': {}
  40. },
  41. optimizeDeps: {
  42. include: ['axios', 'xlsx']
  43. },
  44. css: {
  45. preprocessorOptions: {
  46. less: {
  47. modifyVars: {
  48. hack: `true; @import (reference) "${resolve(
  49. 'src/assets/style/breakpoint.less'
  50. )}";`
  51. },
  52. javascriptEnabled: true
  53. }
  54. }
  55. }
  56. })