You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running a react app (with snowpack). I previously used with create-react-app (webpack) and it worked, but when I migrated to snowpack I got the following error. Not sure the bundlers make the difference, but just mentioning for reference.
-- my code --
import { customAlphabet } from 'nanoid';
import { nolookalikes } from 'nanoid-dictionary';
export const CreateId = customAlphabet(nolookalikes, 3);
-- my error (react/snowpack) --
Uncaught SyntaxError: The requested module '../../_snowpack/pkg/nanoid.v3.1.22.js' does not provide an export named 'nolookalikes'
Wondering if anyone has run into a similar problem. I originally thought this library was connected (directly) with nanoid, but I guess maybe not. They had what I think is a similar/related issue? See:
Error: No valid exports main found for 'node_modules\nanoid' #206 ai/nanoid#206
Also, nanoid function works when not used with nanoid-dictionary.
The text was updated successfully, but these errors were encountered:
Thanks for pointing the issue, it's caused by having all the code written in common js modules. I've rewritten the code in ES modules and it should work fine now. I've published a beta 5.0.0-beta.1 version to try it out. You can install it with npm i nanoid-dictionary@beta. Could you please try out the beta and verify that it works now?
I am running a react app (with snowpack). I previously used with create-react-app (webpack) and it worked, but when I migrated to snowpack I got the following error. Not sure the bundlers make the difference, but just mentioning for reference.
-- my code --
import { customAlphabet } from 'nanoid';
import { nolookalikes } from 'nanoid-dictionary';
export const CreateId = customAlphabet(nolookalikes, 3);
-- my error (react/snowpack) --
Uncaught SyntaxError: The requested module '../../_snowpack/pkg/nanoid.v3.1.22.js' does not provide an export named 'nolookalikes'
Wondering if anyone has run into a similar problem. I originally thought this library was connected (directly) with nanoid, but I guess maybe not. They had what I think is a similar/related issue? See:
Error: No valid exports main found for 'node_modules\nanoid' #206
ai/nanoid#206
Also, nanoid function works when not used with nanoid-dictionary.
The text was updated successfully, but these errors were encountered: