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

Log where module failures occur #200

Open
aryzing opened this issue Sep 2, 2024 · 2 comments
Open

Log where module failures occur #200

aryzing opened this issue Sep 2, 2024 · 2 comments

Comments

@aryzing
Copy link

aryzing commented Sep 2, 2024

Currently, when attw fails, the error message may look something like,

A require call resolved to an ESM JavaScript file, which is an error in Node and some bundlers. CommonJS consumers will need to use a dynamic import. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/CJSResolvesToESM.md.

The immediate question that comes to mind is: where is the import causing the failure? It would save considerable time and add clarity to the error message if the location of the incorrect module import was logged.

@andrewbranch
Copy link
Collaborator

It’s not a require call in the package, it’s a require call of the package. The way attw works is it essentially generates a fake file like

const _ = require("the-pkg")

and sees what happens. I agree the text could be more clear.

@aryzing
Copy link
Author

aryzing commented Sep 4, 2024

Thank you for clarifying, that makes sense! 🤦 Happy to close if not going to use the issue for rewording

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