Replies: 1 comment 1 reply
-
Hi, thanks for opening, and I'm sorry for moving this to discussions without more context. So you are correct in that we decided to pick the However, it seems like there is no one-size-fits-all solution here, as some packages (like We have started working with the Web-interoperable Runtimes Community Group (WinterCG) to standardize new options, that would let package authors distribute a bundle in the future that is specific for Edge and similar runtimes: wintercg/admin#36 |
Beta Was this translation helpful? Give feedback.
-
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Chrome 105
How are you deploying your application? (if relevant)
N/A
Describe the Bug
We are using turndown in our project. When we try to use the
experimental-edge
runtime, it throwsReferenceError: window is not defined
.turndown
provides two builds: one for server (node_modules/turndown/lib/turndown.es.js
) and one for the browser (node_modules/turndown/lib/turndown.browser.es.js
).It seems that Next.js is using the browser build on the server side, and since the server don't have
window
, it crashes.Expected Behavior
Next.js
experimental-edge
runtime should use the server build fromturndown
.Link to reproduction
https://github.com/issueset/nextjs-experimental-edge-turndown
To Reproduce
Use browser to open http://localhost:3000/api/hello, you should see the following error:
Turn off the dev sever. Edit
node_modules/turndown/package.json
and remove thebrowser
field from it, so that Next.js won't know the existence ofturndown.browser.es.js
.Then run the follow shell command
Open http://localhost:3000/api/hello again, now it should work fine and shown the following content:
Beta Was this translation helpful? Give feedback.
All reactions