vite.config.js 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. import { fileURLToPath, URL } from 'node:url'
  2. import { defineConfig } from 'vite'
  3. import vue from '@vitejs/plugin-vue'
  4. import graphql from '@rollup/plugin-graphql';
  5. import { viteRequire } from 'vite-require'
  6. import svgLoader from 'vite-svg-loader'
  7. // https://vitejs.dev/config/
  8. export default defineConfig({
  9. plugins: [vue(), graphql(), viteRequire(), svgLoader({defaultImport: 'raw'})],
  10. resolve: {
  11. alias: {
  12. '@': fileURLToPath(new URL('./src', import.meta.url)),
  13. '@stores': fileURLToPath(new URL('./src/stores', import.meta.url)),
  14. '@components': fileURLToPath(new URL('./src/components', import.meta.url)),
  15. '@views': fileURLToPath(new URL('./src/views', import.meta.url)),
  16. '@api': fileURLToPath(new URL('./src/api', import.meta.url)),
  17. // '@icons': fileURLToPath(new URL('./node_modules/vue-material-design-icons', import.meta.url)),
  18. '@node_modules': fileURLToPath(new URL('./node_modules', import.meta.url))
  19. }
  20. },
  21. css: {
  22. preprocessorOptions: {
  23. scss: {
  24. // example : additionalData: `@import "./src/design/styles/variables";`
  25. // dont need include file extend .scss
  26. additionalData: `@import "./src/assets/colors.scss";@import "./src/assets/common.scss";`
  27. },
  28. },
  29. },
  30. })