Skip to content
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

Vite bundler warnings for "stream" and "events" nodejs modules #26

Open
hexcowboy opened this issue May 9, 2024 · 1 comment
Open

Comments

@hexcowboy
Copy link

When bundling with Vite, we are seeings some warnings

[plugin:vite:resolve] Module "stream" has been externalized for browser compatibility, imported by "/project/node_modules/through/index.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] Module "stream" has been externalized for browser compatibility, imported by "/project/node_modules/multipipe/index.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] Module "stream" has been externalized for browser compatibility, imported by "/project/node_modules/html-tokenize/node_modules/readable-stream/readable.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] Module "events" has been externalized for browser compatibility, imported by "/project/node_modules/html-tokenize/node_modules/readable-stream/lib/_stream_readable.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] Module "stream" has been externalized for browser compatibility, imported by "/project/node_modules/html-tokenize/node_modules/readable-stream/lib/_stream_readable.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] Module "stream" has been externalized for browser compatibility, imported by "/project/node_modules/html-tokenize/node_modules/readable-stream/lib/_stream_writable.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] Module "events" has been externalized for browser compatibility, imported by "/project/node_modules/duplexer2/node_modules/readable-stream/lib/_stream_readable.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin:vite:resolve] Module "events" has been externalized for browser compatibility, imported by "/project/node_modules/duplexer2/node_modules/readable-stream/lib/internal/streams/stream-browser.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

What is the recommendation for these warnings? It seems like we haven't had any issues in Firefox or Chrome, but I'm assuming some browsers won't provide these modules. Should we be polyfilling them?

@Titou325
Copy link
Member

Titou325 commented May 9, 2024

Hey @hexcowboy, thanks for bringing that up!

The stream implementation isn't needed in the current state of the library and it is safe to ignore across browsers. However, we will take a look at how we can treeshake to remove the need for them in the first place.

Thanks!

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

No branches or pull requests

2 participants