The `package.json` is missing the `main` or `exports` fields
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 52/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- build-system
Research direction
Start by inspecting package.json, the existing dist folder, and the referenced index.js entry point. Check the package contents that would be published and how the current build output is consumed; done means only the intended dist files are distributed and package imports resolve to the transpiled entry point.
Written by the indexing model from the issue text.
Description
Issue
The package.json doesn't filter what files should be packaged and sent the NPM. Therefore, all the source code with .less files is being distributed.
Also, the entry point of the package is not specified using main, module, or exports. That way, it's confusing for the bundlers what should be used and usually they start picking the files from the src:
https://github.com/NUKnightLab/TimelineJS3/blob/c5948d41fd333a1d292ec1c497c38e52ef793013/index.js#L1
So it requires to double-transpile the package in the consuming app and they don't benefit from the transpilation done before publishing anyway 😢
Suggested changes
- Limit the distributed code only to the
distfolder. That will significantly reduce the size of the package. - Specify an entry point explicitly and it should point to the transpiled files in the
dist.
Smth like this[^1]:
{
"name": "@knight-lab/timelinejs",
"version": "4.0.0",
"type": "module",
"files": [
"dist"
],
"exports": {
".": {
"import": "./dist/index.js"
}
},
"main": "./dist/index.js",
...
Config breakdown
Node has already come up with the following package.json properties that allow to limit what will get published to NPM:
- files - "an array of file patterns that describes the entries to be included when your package is installed as a dependency"
- main - "a module ID that is the primary entry point to your program. That is, if your package is named
foo, a user installs it, and then doesrequire("foo")" - types - Set the types property to point to your bundled declaration file.
- exports - "defining the entry points of a package. An alternative to the "main" that can support defining "subpath exports" and "conditional exports".
- Dominant language
- JavaScript
- Stars
- 3.2k
- Forks
- 645
- PR merge metrics
- No merged PRs in 30d
Contributor guide
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 NUKnightLab/TimelineJS3
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
NUKnightLab/TimelineJS3#797 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
NUKnightLab/TimelineJS3#617 ·
-
Bug CSS
Difficulty 1/5 Under an hour Newbie friendliness 62/100
NUKnightLab/TimelineJS3#602 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
NUKnightLab/TimelineJS3#904 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
NUKnightLab/TimelineJS3#902 · 2 comments ·
All issues in NUKnightLab/TimelineJS3
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
Browser Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-javascript#24577 · 1 comment ·
-
curation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
amponce/archive-movie-browser#186 ·
-
light
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
aemdemos/patients-stryker#253 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
clerk/javascript#9852 ·