-
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
Disabling native node modules with browser field not working #238
Comments
I think I understand what's going on. This isn't related to The problem is that esbuild still maps this module to an absolute path even though it's disabled. That way all calls to I'll think of a way to solve this. Perhaps a good way to solve this is to just have every |
@evanw quick questions because I'm wondering if the behaviour should not be extended. Using the module https://github.com/APIDevTools/json-schema-ref-parser is not possible with A solution with other bundlers is to use the
But I'm gonna try with a typescript |
esbuild supports the
browser
field inpackage.json
, but it doesn't seem to support it for native node modules (such asfs
, etc)I'm having the issue while building a project with the dependency
@apidevtools/json-schema-ref-parser
which explicitly setfs
tofalse
The error concerning
url
,http
,https
are making sense because they are not being listed in thebrowser
field (and can be added as dependencies in the parent project from Yarn). But the one forfs
doesn't make sense.I've seen integration tests for the browser field, but I feel like one is missing for native node modules.
The issue seems to come from the
loadNodeModule
call when the module is set tofalse
inbrowser
.esbuild/internal/resolver/resolver.go
Lines 201 to 206 in 99dc3f7
It looks like
loadNodeModule
should have a list of native node modules to consider as existing. Or if the value inbrowser
isfalse,
it should just ignore the module.The text was updated successfully, but these errors were encountered: