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

Missing redirect => broken import #18528

Open
3 tasks done
WebReflection opened this issue Sep 12, 2023 · 5 comments
Open
3 tasks done

Missing redirect => broken import #18528

WebReflection opened this issue Sep 12, 2023 · 5 comments
Assignees

Comments

@WebReflection
Copy link

Description

This url https://cdn.jsdelivr.net/npm/@pyscript/core correctly understands the original file:

Original file: /npm/@pyscript/core@0.1.15/index.js

however, the original file would import from /npm/@pyscript/core@0.1.15/ while currently your served file let the browser think that a /npm/@pyscript/dist project exists, which is not the case.

In short, if that /core end points serves this content:

export * from "./dist/core.js";

the whole package breaks because /core is considered the current file while /core/index.js is the actual base URL reference.

Affected jsDelivr links

https://cdn.jsdelivr.net/npm/@pyscript/core

Response headers

not relevant

Information

not relevant

Requisites

  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.
  • I understand that not filling out this template correctly will lead to the issue being closed.

Additional content

The only way to fix this right now is via importmap that catches all @pyscript/dist prefixes and redirect these to @pyscript/core/dist but that seems unfortunate, as workaround, and it prevents us from publishing in the future a @pyscript/dist module with anything else different from core.

@WebReflection
Copy link
Author

FYI we're trying to see if an intentionally broken artifact could fix the current state but I am worried if you fix this bug instead such artifact will suddenly break too ... if you think you are going to fix this please let me know but if you think that's just fine as it is then we should be good if the jsdelivr field in package.json is granted to have higher priority than others, thank you.

@WebReflection
Copy link
Author

P.S. I can confirm the artifact works via import('https://cdn.jsdelivr.net/npm/@pyscript/core@latest')

@MartinKolarik
Copy link
Member

I don't expect this to change, it's a known limitation of the default files. You have several options, however:

@WebReflection
Copy link
Author

it's a known limitation of the default files

unpkg simply redirects to the entry point which works as expected so this seems to be more a choice (avoid redirect) than a limitation but I am OK with this answer if it means we can trust current jsdelivr to point at a non existent path that replicates the actual module name so we're good and you can close this, thank you!

@WebReflection
Copy link
Author

P.S. +esm breaks in all possible ways and we're creating our own optimized dist folder that should never need extra changes on top ... but we got it solved with jsdelivr and nothing indeed breaks with that 👍

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