vite.config.js 718 B

1234567891011121314151617181920212223242526272829
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import AutoImport from 'unplugin-auto-import/vite'
  4. import Components from 'unplugin-vue-components/vite'
  5. import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
  6. const TEMPLATE_API_URL = 'api/';
  7. // https://vitejs.dev/config/
  8. export default defineConfig({
  9. base: './',
  10. define: {
  11. 'process.env.TEMPLATE_API_URL': JSON.stringify(TEMPLATE_API_URL),
  12. },
  13. plugins: [
  14. vue(),
  15. AutoImport({
  16. resolvers: [ElementPlusResolver()]
  17. }),
  18. Components({
  19. resolvers: [ElementPlusResolver()]
  20. })
  21. ],
  22. server: {
  23. fs: {
  24. // 可以为项目根目录的上一级提供服务
  25. allow: ['..']
  26. }
  27. }
  28. })