Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Import with JSDeliver broken #524

Open
ajdubovoy opened this issue Jan 26, 2024 · 0 comments
Open

Import with JSDeliver broken #524

ajdubovoy opened this issue Jan 26, 2024 · 0 comments

Comments

@ajdubovoy
Copy link

ajdubovoy commented Jan 26, 2024

Hi, this code:

import * as mapboxmapboxGlGeocoder from 'https://esm.run/@mapbox/mapbox-gl-geocoder';

console.log(mapboxmapboxGlGeocoder)

will raise the following error:

Uncaught TypeError: Cannot read properties of null (reading 'nanoid')
    at events.js:2:32

So, the package is not importable at all. As far as I can tell, the issue seems to be that if i go to https://cdn.jsdelivr.net/npm/nanoid@3.3.7/+esm, it gives no default export (export default null), whereas the Mapbox package is set to import s from"/npm/nanoid@3.3.7/+esm" and then does s.nanoid and that's null. So, I believe the solution would be instead to:

import { nanoid } from"/npm/nanoid@3.3.7/+esm"

and to rely on the specific export rather than the default export.

Thanks so much!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant