vite.config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { fileURLToPath } from 'node:url'
  2. import autoprefixer from 'autoprefixer'
  3. import postcssLogical from 'postcss-logical'
  4. import postcssDirPseudoClass from 'postcss-dir-pseudo-class'
  5. const ROOT = new URL('../../', import.meta.url)
  6. const PACKAGES_ROOT = fileURLToPath(new URL('./packages/', ROOT))
  7. /**
  8. * @type {import('vite').UserConfig}
  9. */
  10. const config = {
  11. envDir: fileURLToPath(ROOT),
  12. css: {
  13. postcss: {
  14. plugins: [
  15. autoprefixer,
  16. postcssLogical(),
  17. postcssDirPseudoClass(),
  18. ],
  19. },
  20. },
  21. esbuild: {
  22. jsxFactory: 'h',
  23. jsxFragment: 'Fragment',
  24. },
  25. resolve: {
  26. alias: [
  27. {
  28. find: /^uppy\/(.+)$/,
  29. replacement: `${PACKAGES_ROOT}uppy/$1`,
  30. },
  31. {
  32. find: /^@uppy\/([^/]+)$/,
  33. replacement: `${PACKAGES_ROOT}@uppy/$1/src/index.js`,
  34. },
  35. {
  36. find: /^@uppy\/([^/]+)\/lib\/(.+)$/,
  37. replacement: `${PACKAGES_ROOT}@uppy/$1/src/$2`,
  38. },
  39. // {
  40. // find: /^@uppy\/([^/]+)\/(.+)$/,
  41. // replacement: PACKAGES_ROOT + "@uppy/$1/src/$2",
  42. // },
  43. ],
  44. },
  45. }
  46. export default config