diff --git a/.npmignore b/.npmignore
index 02d405704e402a39cd18b3f8d087690df368da3f..814eeff3892258a6011e535fdbd7438882a50118 100644
--- a/.npmignore
+++ b/.npmignore
@@ -1 +1,5 @@
-lib/tsconfig.commonjs.tsbuildinfo
\ No newline at end of file
+tests
+perf-tests
+_spec
+*.tsbuildinfo
+*.js.map
\ No newline at end of file
diff --git a/package.json b/package.json
index 9fa802f171d0b847794b2e240fa4c3128719936c..a7d8aa912bbbf675d728347445faaef2c6aba23c 100644
--- a/package.json
+++ b/package.json
@@ -38,7 +38,7 @@
     "volume-server-test": "node lib/commonjs/servers/volume/server.js --idMap em 'test/${id}.mdb' --defaultPort 1336",
     "plugin-state": "node lib/commonjs/servers/plugin-state/index.js --working-folder ./build/state --port 1339",
     "preversion": "npm run test",
-    "version": "npm run rebuild",
+    "version": "npm run rebuild && cpx .npmignore lib/.npmignore",
     "postversion": "git push && git push --tags"
   },
   "files": [