Skip to content
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

Unpkg CDN Issue: JSON Imports via ES Module Syntax Fail with 403 Error #373

Open
lsongdev opened this issue Nov 2, 2023 · 1 comment
Open

Comments

@lsongdev
Copy link

lsongdev commented Nov 2, 2023

When I use the esptool-js library is imported as a module using unpkg with the ES module query parameter (https://unpkg.com/esptool-js/lib/index.js?module), the service appends ?module to the import statement, including for JSON files.

For instance, these URLs are affected:

However, the service returns an error stating, module mode is available only for JavaScript and HTML files. This issue occurs when the ESPLoader library attempts to import a JSON file as part of its module graph.

Unpkg should either serve JSON files without appending the ?module query parameter or properly handle JSON imports when in ES module mode.

@justinfagnani
Copy link

Importing JSON only works with the {type: 'json'} import assertion, so that module is invalid.

Regardless, unpkg seems to be completely unmaintained now, so I doubt it would support import assertions and JSON modules anyway.

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

No branches or pull requests

2 participants