exports "./getPolyfill" points at getPolyfill.js, but the package ships polyfill.js
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript
- Domain
- api
Research direction
Start in package.json and compare the ./getPolyfill export with the shipped polyfill.js and the require path in index.js. Reproduce the failure with the provided Node import command, then verify that the chosen export convention resolves successfully from the package and remains consistent with the published file list.
Written by the indexing model from the issue text.
Description
The problem
package.json maps "./getPolyfill" to "./getPolyfill.js", and the package ships polyfill.js. There is no getPolyfill.js, on main or in the published tarball, so that subpath cannot be imported.
Reproduce
npm i string.prototype.repeat@1.0.0
node --input-type=module -e "await import('string.prototype.repeat/getPolyfill')"
ERR_MODULE_NOT_FOUND: Cannot find module '.../string.prototype.repeat/getPolyfill.js'
Details
"exports": {
".": "./index.js",
"./auto": "./auto.js",
"./shim": "./shim.js",
"./getPolyfill": "./getPolyfill.js", <- no such file
"./implementation": "./implementation.js",
"./package.json": "./package.json"
}
Contents of the published 1.0.0 tarball: LICENSE-MIT.txt, README.md, auto.js, implementation.js, index.js, package.json, polyfill.js, shim.js, tests/.
The other four subpaths all resolve; this is the only one that does not.
Node performs no extension or name search on an exports target — it is taken exactly as written — so nothing falls back to polyfill.js.
Two ways to fix it, and which one you want depends on the convention you'd rather keep:
- point the mapping at the file that exists —
"./getPolyfill": "./polyfill.js", or - rename
polyfill.jstogetPolyfill.js, which is what the sibling es-shims packages call it and whatindex.jswould then require.
Happy to open a PR for whichever you prefer.
Notes
Found by an automated checker I'm building that compares a manifest's declared entry points against the files a package actually ships. I verified this one by hand against the published 1.0.0 tarball and against main before filing.
- Dominant language
- JavaScript
- Stars
- 28
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mathiasbynens/String.prototype.repeat
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
mathiasbynens/String.prototype.repeat#9 · 2 comments ·
All issues in mathiasbynens/String.prototype.repeat
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·