"Omit the file path to get the default file" breaks imports
Description
I have a package hic-pageflip. When loading through jsdelivr, authors can import it from https://cdn.jsdelivr.net/npm/hic-pageflip/index.js
Because of the “Omit the file path to get the default file” feature, the package can also be loaded from https://cdn.jsdelivr.net/npm/hic-pageflip (without a trailing slash).
But: because there is no trailing slash, imports are broken.
For examle: my code does an import like this:
import { HICPageflip } from"./components/hic-pageflip.js"Which results in a request to https://cdn.jsdelivr.net/npm/components/hic-pageflip.js.
This:
- Does not work, because the path is not correct.
- Can be abused by a package named
components(!!!)
Recommendation: The “Omit the file path to get the default file” feature should also rewrite import paths that try to import from a path starting with ./.
Affected jsDelivr links
https://cdn.jsdelivr.net/npm/hic-pageflip
(But in reality: any, actually)
Response headers
(All headers are correct)
Information
- Device OS: Any
- Browser & Version: Any
- VPN provider: Any
- Your location: Any
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
No response
Source: jsdelivr/jsdelivr