-
-
Notifications
You must be signed in to change notification settings - Fork 821
Fix CJS compatibility #490
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
Conversation
|
|
Signed-off-by: FurryR <[email protected]>
Signed-off-by: FurryR <[email protected]>
Tested with |
But Nano ID 4.x and 5.x don’t support |
@ai any way you can guys ship this? I was trying using nanoId with typescript the problem is that when I transpile and push the code to google app engine, it says that the require() is not supported. Maybe you have a workaround instead of needing this PR? |
@ferreiro as I told I need some investigation that it will not break in many possible cases where Nano ID is used. If you need it, please help to the community. |
Hmm. weird. If you access https://cdn.jsdelivr.net/npm/[email protected]/non-secure/+esm you will see. |
Anyway, I will close this PR and wait for a better workaround. Thank you all guys. |
Proposed Changes
Ensure compatibility with some CDNs & bundlers on some CJS libraries.
jsDelivr translates
const { nanoid } = require('nanoid')
directly intoimport e from 'nanoid/+esm'; const { nanoid } = e
, which is problematic and causes some libraries fail to load.Here is an example using
postcss
:Additional Information
It is suggested to squash merge this PR.