DEV Community

Discussion on: I created my first TypeScript library and published it on NPM

Collapse
 
hendrikfoo profile image
Hendrik Richert

Good write up!
Is there a specific reason why you include the src folder in your package?

The way I do it is to only have dist-files in the npm package, and on the other hand gitignore those for the GitHub repo.
As in:
repo: sources and config only
package: dist only

Your consumers might enjoy the smaller package size if you leave out sources from the bundle :-)

Collapse
 
learosema profile image
Lea Rosema (she/her) • Edited

Good point, I think excluding src from the package is the right way.

Initially, I thought of a scenario when using TypeScript, one could somehow import directly from the ts sources, and let the bundling be done by one's own transpiling toolchain, but that's out of scope of NPM, I guess. At least, there is no clean way to do that via NPM (yet).

Collapse
 
hendrikfoo profile image
Hendrik Richert

cough deno.land/ cough :-)