Search code examples
npmnpm-publishnpm-pack

How to pack latest changes using npm pack?


I am trying to test one of the package locally. What I do is go the root directory of my package and run

npm pack

It creates .tgz file and I install this file via npm i <path to file>. Now I found that some of my recent changes are missing in this .tgz file. I have made some tiny modifications in css file and those are not reflected in packaged .tgz file. I am not sure what is wrong here. I have looked into internet but all questions in SA and other resources says to use 'npm pack' to create tgz file, but not about this issue.

npm version 6.14.13


Solution

  • Did you do npm run build to build the latest code change? I encountered the same issue today and this was the step I forgot.

    To troubleshoot, you can unzip the tgz and inspect the source files there directly to see if they are the latest version.

    You can also look into the dist folder in your local repository. After running npm run build, the source code in dist folder should reflect the latest code.