Skip to content

Conversation

@mtlynch
Copy link

@mtlynch mtlynch commented Dec 29, 2025

This package has a single export that includes both NodeJS and browser modules. When a web project imports this library, the bundler also imports the NodeJS-only modules, which generates a bunch of warnings, like this in vite:

[plugin vite:resolve] Module net has been externalized for browser compatibility... 
[plugin vite:resolve] Module stream has been externalized for browser compatibility... 
...

We can clean this up by creating a special browser-only export. Bundlers like Vite and Webpack know to choose the 'browser' export in projects that are web-only (not NodeJS).

This change adds a 'browser' export and updates the documentation to use browser-only examples.

Clients don't need to change anything to benefit from this new export. The bundlers should just see the 'browser' export and use it automatically, but the warning spew will disappear.

This package has a single export that includes both NodeJS and browser modules. When a web project imports this library, the build generates a bunch of warnings, like this in vite:

[plugin vite:resolve] Module net has been externalized for browser compatibility...
[plugin vite:resolve] Module stream has been externalized for browser compatibility...
...

We can clean this up by creating a special browser-only export. Bundlers like Vite and Webpack know to choose the 'browser' export in projects that are web-only (not NodeJS).

This change adds a 'browser' export and updates the documentation to use browser-only examples.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant