vite.config.js 894 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import {defineConfig} from 'vite'
  2. import {createVuePlugin} from 'vite-plugin-vue2'
  3. import {resolve} from 'path'
  4. import WindiCss from 'vite-plugin-windicss';
  5. // https://vitejs.dev/config/
  6. export default defineConfig(({command}) => {
  7. const config = {
  8. plugins: [
  9. createVuePlugin({
  10. jsx: true,
  11. }),
  12. WindiCss()
  13. ],
  14. server: {
  15. port: 3001,
  16. },
  17. build: {
  18. target: 'esnext'
  19. },
  20. resolve: {
  21. alias: {
  22. '~': resolve(__dirname, 'src'),
  23. '@': resolve(__dirname, 'src'),
  24. '@c': resolve(__dirname, 'src/components'),
  25. },
  26. },
  27. css: {}
  28. }
  29. if (command === 'build') {
  30. config.base = ''
  31. } else {
  32. config.base = '/'
  33. }
  34. return config
  35. })