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

fix(config): remove error if require resolve to esm #18437

Merged
merged 5 commits into from
Oct 28, 2024
Merged

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Oct 23, 2024

Description

@joyeecheung mentioned in the e18e server that the friendly error in #13283 was preventing require(esm) from working. I've removed it in this PR.

I intially wanted to check NODE_OPTIONS or node >=23 instead, but that opens up needing to check for deno and bun too since they support it, so I figured it's easier to simply remove it. However, I'm open to doing the checks still if we prefer.

NOTE: This PR does not remove the other error reporting when we couldn't resolve a CJS entrypoint for an ESM package. Some package like @sveltejs/vite-plugin-svelte export ESM with the "import" condition only, so node wouldn't be able to resolve it still for require(esm).

@sapphi-red sapphi-red added the p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) label Oct 24, 2024
sapphi-red
sapphi-red previously approved these changes Oct 24, 2024
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can add a friendly error here instead if we need to. But I guess there won't be much users using CJS config now and not worth doing it.

docs/guide/troubleshooting.md Outdated Show resolved Hide resolved
Co-authored-by: 翠 / green <[email protected]>
@bluwy
Copy link
Member Author

bluwy commented Oct 24, 2024

Yeah I think that would involve tracking the specifier to its resolved path, which is tricky to handle and not really worth it now as most of our recommended setups don't use or compile to CJS.

@sapphi-red
Copy link
Member

The test fails should be fixed by #18446.

@bluwy bluwy enabled auto-merge (squash) October 28, 2024 15:25
@bluwy bluwy merged commit f886f75 into main Oct 28, 2024
14 checks passed
@bluwy bluwy deleted the require-esm-error branch October 28, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants