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

Compile error when adding to nextjs app router #264

Open
mastoj opened this issue Feb 18, 2025 · 2 comments
Open

Compile error when adding to nextjs app router #264

mastoj opened this issue Feb 18, 2025 · 2 comments

Comments

@mastoj
Copy link

mastoj commented Feb 18, 2025

I followed the instructions on how to add to nextjs using a component, https://github.com/aidenybai/react-scan/blob/main/docs/installation/next-js-app-router.md.

For some reason it fails to compile when added:

./node_modules/preact/dist/preact.module.js
Specified module format (CommonJs) is not matching the module format of the source code (EcmaScript Modules)
The CommonJs module format was specified in the package.json that is affecting this source file or by using an special extension, but Ecmascript import/export syntax is used in the source code.
The module was automatically converted to an EcmaScript module, but that is in conflict with the specified module format. Either change the "type" field in the package.json or replace EcmaScript import/export syntax with CommonJs syntas in the source file.
In some cases EcmaScript import/export syntax is added by an transform and isn't actually part of the source code. In these cases revisit transformation options to inject the correct syntax.

Image

@lxsmnsyc
Copy link
Collaborator

lxsmnsyc commented Feb 18, 2025

Do you have "type": "module" in your package.json?

@mastoj
Copy link
Author

mastoj commented Feb 18, 2025

@lxsmnsyc , yes we have. Not possible to change at the moment I'm afraid.

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