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

Rethrow error if not ESM import error #1

Merged
merged 15 commits into from
Dec 17, 2023
Merged

Conversation

karlhorky
Copy link
Member

@karlhorky karlhorky commented Dec 17, 2023

Copy of lukeed#36 for @upleveled/ley package until merged and published in mainline ley


Today when running ley new we received an error with ERR_REQUIRE_ESM:

  • ley.config.mjs which had a JS error in it
  • error swallowed by the try/catch in load() from utils.js
  • require() ran on the ley.config.mjs file, which results in ERR_REQUIRE_ESM instead, which was confusing

This PR instead rethrows the error if it's not an error related to importing the ESM file (inspired by similar code in tsm)

@karlhorky karlhorky merged commit 352f724 into upleveled:master Dec 17, 2023
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

Successfully merging this pull request may close these issues.

1 participant