Consider the following:If my page is at and my code says import nanoid from 'nanoid' the browser is going to make a request to and the browser is expecting a javascript file but it's likely receiving an error 404 html page.
I've taken the browser version of the code from the github and put it into a script tag (getting rid of the urlAlphabet import) below that you can add to your code. Keep in mind this code will add the nanoid, customAlphabet, customRandom, urlAlphabet, and random variables globally so make sure there aren't any collisions with your global variables.
I wanted to get a reality check from the wise folks of the forum on the differences and pros/cons in uuid vs. nanoid. UUIDv4 has been my go-to for primary keys for a while, but the nanoid package is garnering some attention (there is an Elixir port). NanoID promises to save on real-estate: a human may be able to type one more easily because a NanoID can be shorter than a UUID (at least on the screen).
760c119bf3