uniqid icon indicating copy to clipboard operation
uniqid copied to clipboard

when uniqid in vite project and typescript show error Uncaught Error: Module "os" has been externalized for browser compatibility. Cannot access "os.networkInterfaces" in client code.

Open gradyll opened this issue 1 year ago • 2 comments

when i import uniqid,it show this error:"Uncaught Error: Module "os" has been externalized for browser compatibility. Cannot access "os.networkInterfaces" in client code."

Why?

gradyll avatar Jul 16 '22 15:07 gradyll

I just ran into this issue as well, and looks like that's because this package only exports CommonJS module format, and Vite doesn't polyfill those by default:

Screen Shot 2022-07-18 at 11 16 32 AM

I'm going to be looking for an ESM-compatible alternative personally.

mryechkin avatar Jul 18 '22 15:07 mryechkin

We are facing this issue as well

Jonas096 avatar Apr 15 '24 08:04 Jonas096