vite.config.js 713 B

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