You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.
I expect buffer to be excluded from the bundle, and stream to be replaced with stream-browserify.
Actual Behavior
Errors related to depending on node built-ins.
If we roll up a dependency on this library, everything works as expected. However, if we roll up the library itself, these fields are not consulted. The reason is that the plugin will not read package.json browser field without first resolving an import to that module. File replacements as in the last example work fine because importing e.g. ./index.node.js will resolve to the local package with the package.json browser field loaded. "buffer" and "stream" will fail to resolve, however, and so we never get a chance to examine the package.json browser field.
I would write a PR fixing this issue, but I'm actually not sure how to test this properly since the test samples don't seem to have their own package.json files and I'm not sure where it would make sense to put one.
The text was updated successfully, but these errors were encountered:
Upon even further investigation, this also only applies when the project's input config isn't a relative or absolute path. If your input starts with ./, everything works fine.
How Do We Reproduce?
Given a library with a package.json browser entry like:
Now run rollup on this library.
Expected Behavior
I expect buffer to be excluded from the bundle, and stream to be replaced with stream-browserify.
Actual Behavior
Errors related to depending on node built-ins.
If we roll up a dependency on this library, everything works as expected. However, if we roll up the library itself, these fields are not consulted. The reason is that the plugin will not read package.json browser field without first resolving an import to that module. File replacements as in the last example work fine because importing e.g.
./index.node.js
will resolve to the local package with the package.json browser field loaded. "buffer" and "stream" will fail to resolve, however, and so we never get a chance to examine the package.json browser field.I would write a PR fixing this issue, but I'm actually not sure how to test this properly since the test samples don't seem to have their own package.json files and I'm not sure where it would make sense to put one.
The text was updated successfully, but these errors were encountered: