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: webpack needs its own export condition #5833

Merged
merged 2 commits into from
Apr 5, 2024

Conversation

etrepum
Copy link
Contributor

@etrepum etrepum commented Apr 5, 2024

Webpack (and SWC?) produce some truly inscrutable error messages when you provide it with ESM that uses top-level await. Unfortunately, it also prefers to load "node" condition code over "default". In order to support both node ESM imports and webpack at the same time we need to add a separate "webpack" condition at a higher priority than "node".

Related reading: https://webpack.js.org/guides/package-exports/#conditions-preprocessor-and-runtimes

🤦

Fix #5823

Copy link

vercel bot commented Apr 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 5, 2024 4:31am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 5, 2024 4:31am

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 5, 2024
@etrepum etrepum marked this pull request as ready for review April 5, 2024 04:30
@2wheeh
Copy link
Contributor

2wheeh commented Apr 5, 2024

You are amazing !

@etrepum
Copy link
Contributor Author

etrepum commented Apr 5, 2024

It doesn't always feel that way after weeks of fixing one thing and breaking something else in the process 😅 At least everyone is nice here!

@ivailop7
Copy link
Collaborator

ivailop7 commented Apr 5, 2024

Seeing all these webpack-related issues, is a good reminder why everyone embraced vite and esbuild so fast.

@ivailop7 ivailop7 merged commit 1c46eb6 into facebook:main Apr 5, 2024
45 checks passed
tvongaza pushed a commit to aeon-health/lexical-old that referenced this pull request Apr 16, 2024
@acywatson acywatson mentioned this pull request Apr 16, 2024
@etrepum etrepum deleted the nextjs-webpack-fixes branch May 11, 2024 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: fails to compile on nextjs Client Component SSR - Error: Element type is invalid: expected a string
5 participants