-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Is "browser" field supported in node_modules dependencies? #1883
Comments
Continuing investigation, I made a simple example here and it seems that browser field is handled: https://gist.github.com/acailly/986047b786bf2dc247ea47bd2b0a1115 Maybe that means that the problem is related to IPFS lib... |
Feel free to contribute docs about the browser field here: https://github.com/parcel-bundler/website We appreciate any contribution to the docs. the browser field should be fully supported in parcel |
I would like to but I still don't understand why it's not working. I forked my previous example to use I checked with webpack and browserify with the same example and it worked. I have no clue why it's happening π |
Works perfectly for me, your example is missing a polyfill though. Add this to the first line of require('babel-polyfill'); Parcel should automagically install it |
I just tried with |
What is the error? |
Sorry, I thought I had posted it already
The code causing the error should not be executed in browser, it is the node version of the lib |
I don't know, seems to work for me, might be something with windows as we don't test anything on it anymore (as all/most contributors use mac) |
There is definitely a divergence of behaviour handling the browser field of dependent packages on windows vs unix systems. A more minimal test case to reproduce the behaviour is:
This outputs 'i am the default' . The bug only appears when the browser field is a relative path with more than 1 component. |
I'm also seeing this bug - I'm also on Windows. Here is a repo demonstrating this bug. |
Happens only in subfolders, which add that extra backslash. PR sent π |
β Question
Does Parcel handle
browser
fields defined in node_modules the same way browserify and webpack do?π¦ Context
I try to use
ipfs
as a dependency and I found that browser field seem to be ignored by Parcel becaus it doesn't load the browser version of files and doesn't ignore files marked as false.(for example: https://github.com/ipfs/js-ipfs/blob/master/package.json#L11)
I found that another user have a very similar issue (#200 (comment)), which makes me thinks that Parcel does not handle this field the same way browserify and webpack do
And I found that another user had an issue with a missconfigured
browser
field in a node_modules dependency (#1631) which makes me think that Parcel does handle this field the same way browserify and webpack do... and I've not found any documentation regarding this field so I'm asking the question
π Your Environment
The text was updated successfully, but these errors were encountered: