Skip to content

fix: webpack needs its own export condition#5833

Merged
ivailop7 merged 2 commits intofacebook:mainfrom
etrepum:nextjs-webpack-fixes
Apr 5, 2024
Merged

fix: webpack needs its own export condition#5833
ivailop7 merged 2 commits intofacebook:mainfrom
etrepum:nextjs-webpack-fixes

Conversation

@etrepum
Copy link
Copy Markdown
Collaborator

@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

@vercel
Copy link
Copy Markdown

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
Copy Markdown
Contributor

2wheeh commented Apr 5, 2024

You are amazing !

@etrepum
Copy link
Copy Markdown
Collaborator 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
Copy Markdown
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
@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