json-as-xlsx icon indicating copy to clipboard operation
json-as-xlsx copied to clipboard

Module externalized for browser compatibility warning when update to Vite ^5.0.11

Open cn-2k opened this issue 1 year ago • 2 comments

Im building an Vue.js App and after update my vite version I start to receive this warning on console:

image

When going to vite Troubleshooting section they say:

When you use a Node.js module in the browser, Vite will output the following warning.

Module "fs" has been externalized for browser compatibility. Cannot access "fs.readFile" in client code.

This is because Vite does not automatically polyfill Node.js modules.

We recommend avoiding Node.js modules for browser code to reduce the bundle size, although you can add polyfills manually. If the module is imported from a third-party library (that's meant to be used in the browser), it's advised to report the issue to the respective library.

Any tip of how to avoid this warning? Thanks.

[EDIT] I've seen a similar issue opened on SheetJS a time ago: https://github.com/SheetJS/sheetjs/issues/2765

cn-2k avatar Jan 08 '24 17:01 cn-2k

I encountered the same situation and did not find a solution

mariia-yushmanova avatar Jan 31 '24 05:01 mariia-yushmanova

Looking at the code, I suspect that it's not this repo where the issue is but a dependency: "@e965/xlsx"

DaanDL avatar Mar 05 '24 00:03 DaanDL