Esbuild inject adds all node globals for non-node environment #6380
Labels
bug:unverified
needs-response
We need a response from the original author about this issue/PR
package:dev
What version of Remix are you using?
1.16
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
Install esbuild, add esbuild-plugin-polyfill-node plugin. Import commonjs module from entry point. You'll see all polyfills to be included in resulting bundle.
This might be caused by this behavior. Basically esbuild cannot safely require es module from commonjs. So the entire idea to rely on esbuild to inject globals is not good since all remix code and dependencies is commonjs.
evanw/esbuild#1697 (comment)
Expected Behavior
Unnecessary polyfills should not be included.
Remix should have a way to disable all polyfills (disabling only globals is not supported in plugin).
Actual Behavior
Our worker bundle increased with 45kB of unused code.
The text was updated successfully, but these errors were encountered: