vite.config.js 836 B

1234567891011121314151617181920212223242526272829303132333435
  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. build: {
  15. target: 'esnext'
  16. },
  17. resolve: {
  18. alias: {
  19. '~': resolve(__dirname, 'src'),
  20. '@': resolve(__dirname, 'src'),
  21. '@c': resolve(__dirname, 'src/components'),
  22. },
  23. },
  24. css: {}
  25. }
  26. if (command === 'build') {
  27. config.base = ''
  28. } else {
  29. config.base = '/'
  30. }
  31. return config
  32. })