-
-
Notifications
You must be signed in to change notification settings - Fork 790
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
Error when calling nanoid in browser (from 5.0.5) #470
Comments
I just experienced the same issue. In my case it is inside a React app any only in watch mode (using Parcel). |
Ask Parcel team. Seems like there is something wrong with The example works fine in Vite or webpack. |
Developers, Paprcel delets ALL unused exports and imports during tree-shaking. This indicated in documention This behaviour cased of deleting variable of urlAlphabet which actually is in use in generating nanoid. So because the urlAlphabet is not in use in the example the Parcel loses the file acronim name in bundle. Actually it seems as error during a load. I can show more detailes if you want to. But here I expilicetly use the 'urlAlphabet' variable and the nanoid is generated as expected. However, I tend to see a problem of the common agreements betweeen the delovepers. Same name for imported variable while it is aslo exported in the same file is not forbiden in JS. But it can misconfused while static analisize is on. |
@WilhelmYakunin great research. Can you send pull request? (PR UI is better for a few extra checks like benchmark and size limit) |
@WilhelmYakunin fixed the issue in 5.0.7. |
Hi all, UPDATE: |
When calling nanoid from the browser, I get the following error in the console :
Here is a minimal repro :
https://codesandbox.io/p/devbox/tender-perlman-forked-9c35qx?embed=1&file=%2Fsrc%2Findex.mjs&showConsole=true
The text was updated successfully, but these errors were encountered: