-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Possible regression with require('stream')
when bundling for browser in 0.11.16
#1220
Comments
Option 1: avoid the problemIt looks like the "browser": {
"./server.js": "./server.browser.js"
}, You are bundling if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-dom-server.node.production.min.js');
} else {
module.exports = require('./cjs/react-dom-server.node.development.js');
} If your app uses React and is browser-based, you could try importing Option 2: reproduce the problemIf you would still like to fix this then I'm going to need a way to reproduce this myself so that I can add it to my growing test suite of I tried constructing a test case for this that looks like this:
However, esbuild version 0.11.15 isn't able to build this, so I was unable to reproduce your issue:
|
Thanks for your response @evanw! I will see if I can reproduce this in a smaller case. We're only doing |
OK, we found it. We do this in a component: import { renderToString } from 'react-dom/server'; but for some reason we're pulling in the node version despite the browser mapping for the package. We have We removed the instances in our application, this looks like it's coming from dependencies. We have several dependencies that do something like this:
|
Another idea is to potentially try looking at the output of |
We figured it out. We have a package for SSR that imports the node version of We finished migrating our application to use esbuild in production this afternoon and we're extremely excited about it. Thanks also for your time building this. |
Hi, first off, this is an amazing project and the speed at which it's moving is really amazing. We are about to start building our app in production with esbuild and it solves a bunch of issues we've had with resource constraints, etc.
Here's our issue, which isn't hugely urgent, but looks like a regression.
Our app (React, browser-based) builds successfully in 0.11.15, but fails in 0.11.16:
We tried adding
stream-browserify
and mappingstream
to it inpackage.json
without any change. Here's some other stuff from our config that might be relevant:The text was updated successfully, but these errors were encountered: