Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm module missing files after publish

For reference, the repo is https://github.com/microsoftly/luis-response-builder.

The node module files are generated with tsc and output to the dist folder. I have a prepublishOnly step that removes the dist folder, runs tsc, then runs the test against the transpiled js. The tests pass when I publish just fine.

The problem is, when I install the project anywhere else, the dist folder contains only the file with the path dist/src/index.js.

I cannot for the life of me figure out why the file is missing when installed but not when published.

like image 765
Matthew Schwartz Avatar asked Sep 13 '25 07:09

Matthew Schwartz


1 Answers

Quoting from npm-publish Documentation:

All files in the package directory are included if no local .gitignore or .npmignore file exists. If both files exist and a file is ignored by .gitignore but not by .npmignore then it will be included.

Your repository's .gitignore file contains the following:

node_modules
dist
*.env
yarn-error.log

Since dist is being ignored, it's not committed with npm publish, as per the documentation.

like image 84
Patrick Roberts Avatar answered Sep 15 '25 21:09

Patrick Roberts