How can I publish an npm package with distribution files?

When you npm publish, if you don’t have an .npmignore file, npm will use your .gitignore file (in your case you excluded the dist folder).

To solve your problem, create a .npmignore file based on your .gitignore file, without ignoring the dist folder.

Source: Keeping files out of your Package

Leave a Comment