2
0

vite.config.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import { defineConfig } from "vite"
  2. import react from "@vitejs/plugin-react"
  3. import svgr from "vite-plugin-svgr"
  4. import { name } from "./package.json"
  5. const genBaseUrl = (mode) => {
  6. if (mode !== "development") {
  7. if (mode == "test") {
  8. return `/${name}-test/`
  9. }
  10. return `/${name}/`
  11. }
  12. return "/"
  13. }
  14. export default defineConfig(({ mode }) => {
  15. return {
  16. resolve: {
  17. alias: {
  18. "@": "/src",
  19. "@/packages/stt-sdk-core": "/packages/stt-sdk-core/src",
  20. },
  21. },
  22. base: genBaseUrl(mode),
  23. build: {
  24. // cssCodeSplit: false,
  25. // target: "es2015",
  26. },
  27. server: {
  28. host: "0.0.0.0",
  29. allowedHosts: true,
  30. port: 8080,
  31. watch: {
  32. // usePolling: true
  33. ignored: ["playwright-report", "test-results", "dist", "packages/stt-sdk-core/dist"],
  34. },
  35. },
  36. plugins: [
  37. react(),
  38. svgr({
  39. svgrOptions: {
  40. // icon: true,
  41. // typescript: true,
  42. },
  43. }),
  44. ],
  45. css: {
  46. preprocessorOptions: {
  47. scss: {
  48. api: "modern",
  49. },
  50. },
  51. modules: {
  52. // hashPrefix: 'hash',
  53. // generateScopedName: "[name]__[local]__[hash:base64:2]",
  54. // globalModulePaths: [
  55. // /.*\\.global\\..*/
  56. // ]
  57. },
  58. postcss: {
  59. plugins: [],
  60. },
  61. },
  62. }
  63. })