Does anyone have a webpack config modification or @wordpress/wp-scripts extension that takes npm run build and then bundles everything up into a nice little .tgz or .zip without all of the extra development stuff? WPRig does this nicely at the theme level, but I'd like it for simple plugin development. Needless to say, I'm a complete n00b at webpack.

1 Answer 1


npm pack can do this for you. You can configure what it puts in the tarball with a .npmignore file or with the files field in package.json.

An example of the files field:

"files": ["*.json", "readme.txt", "my-plugin.php", "build/*"],

With the above in package.json, running npm pack will produce a .tgz with only the files from that list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.