vite.config.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. jsx: 'transform',
  23. jsxFactory: 'h',
  24. jsxFragment: 'Fragment',
  25. },
  26. resolve: {
  27. alias: [
  28. {
  29. find: /^uppy\/(.+)$/,
  30. replacement: `${PACKAGES_ROOT}uppy/$1`,
  31. },
  32. {
  33. find: /^@uppy\/([^/]+)$/,
  34. replacement: `${PACKAGES_ROOT}@uppy/$1/src/index`,
  35. },
  36. {
  37. find: /^@uppy\/([^/]+)\/lib\/(.+?)(\.js)?$/,
  38. replacement: `${PACKAGES_ROOT}@uppy/$1/src/$2`,
  39. },
  40. // {
  41. // find: /^@uppy\/([^/]+)\/(.+)$/,
  42. // replacement: PACKAGES_ROOT + "@uppy/$1/src/$2",
  43. // },
  44. ],
  45. },
  46. }
  47. export default config