Vite
Vite config loads an ESM-only package with require
Vite hit an ESM-only package from a CommonJS-style config path, so Node could not load the dependency with require.
Vite
Vite hit an ESM-only package from a CommonJS-style config path, so Node could not load the dependency with require.
Observed message
Failed to resolve "foo". This package is ESM only but it was tried to load by `require`.
Why it happens
How to fix it
Official reference
Vite: TroubleshootingRelated errors
Explore more