react-print-pdf
react-print-pdf copied to clipboard
Vite bundler warnings for "stream" and "events" nodejs modules
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?
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!