-
Notifications
You must be signed in to change notification settings - Fork 641
Open
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
:
Line 1 in c5948d4
export { Timeline } from './src/js/index.js'; |
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
dist
folder. 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".
ViktoriiaKozopas, matthewbennink, dadiv, watermehlen, georgiamason27 and 2 more
Metadata
Metadata
Assignees
Labels
No labels