vite.config.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { defineConfig } from 'vite';
  2. import vue from '@vitejs/plugin-vue';
  3. import styleImport from 'vite-plugin-style-import';
  4. const vueJsx = require('@vitejs/plugin-vue-jsx');
  5. const legacy = require('@vitejs/plugin-legacy');
  6. // eslint-disable-next-line @typescript-eslint/no-var-requires
  7. const path = require('path');
  8. function resolve(dir: string) {
  9. return path.join(__dirname, dir);
  10. }
  11. // https://vitejs.dev/config/
  12. // https://github.com/vitejs/vite/issues/1930 .env
  13. export default defineConfig({
  14. plugins: [
  15. vue(),
  16. vueJsx(),
  17. legacy({
  18. targets: ['> 0.25%, not dead'],
  19. ignoreBrowserslistConfig: true
  20. }),
  21. styleImport({
  22. libs: [
  23. {
  24. libraryName: 'vant',
  25. esModule: true,
  26. resolveStyle: name => `vant/es/${name}/style`
  27. }
  28. ]
  29. })
  30. ],
  31. resolve: {
  32. alias: {
  33. '@': resolve('./src'),
  34. '@common': resolve('./src/common'),
  35. '@components': resolve('./src/components'),
  36. '@store': resolve('./src/store'),
  37. '@views': resolve('./src/views')
  38. }
  39. },
  40. server: {
  41. host: '0.0.0.0',
  42. port: 5000,
  43. strictPort: true
  44. },
  45. build: {
  46. rollupOptions: {
  47. input: {
  48. index: path.resolve(__dirname, 'index.html'),
  49. about: path.resolve(__dirname, 'teacher.html')
  50. }
  51. }
  52. }
  53. });