Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"vite-plugin-rewrite-all" resolved to an ESM file. ESM file cannot be loaded by require. #7

Open
ericleponner opened this issue Nov 28, 2023 · 1 comment

Comments

@ericleponner
Copy link

When I try to move from release 1.0.1 to 1.0.2, vite server refuses to start and prints the following error:

failed to load config from /Users/eric/Documents/Hedera/WS/hedera-mirror-node-explorer/vite.config.ts
error when starting dev server:
Error: Build failed with 1 error:
node_modules/esbuild/lib/main.js:1373:27: ERROR: [plugin: externalize-deps] "vite-plugin-rewrite-all" resolved to an ESM file. ESM file cannot be loaded by `require`. See http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.

It looks like release 1.0.2 has changed something in vite-plugin-rewrite-all module construction.
Is this intentional ? Should vite.config.js be adapted to this new release ?

@jeffhuys
Copy link

This is an error.
The PR adds a default field to the exports field of package.json.

Per the Node.JS docs (https://nodejs.org/api/packages.html#conditional-exports):

"default" - the generic fallback that always matches. Can be a CommonJS or ES module file. This condition should always come last

Switching it to be last made it work again.

I will create a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants