How to remove test package in production


#1



After I add bundle-visualizer and run my application in production mode, the …chai test package is still on the bundle, and there are other test packages as well, is that normal?


#2

Meteor projects, unlike packages, can’t configure test only packages for some reason.

The package author should have added testOnly:true to Package.describe, but Practicalmeteor:chai hasn’t been updated in 3 years.

You could clone the package from github into your project’s /packages folder (create it if it doesn’t exist) and then edit the package.js yourself. Meteor will use packages from the /packages folder over atmosphere packages if you put them there.


#3

What is the command that you are using? If its the below:

meteor run --production

Then yes. --production does nothing more then simulating production minification and should never be ran in production! Instead use the below for testing:slight_smile:

meteor run --production --extra-packages bundle-visualizer

This will not install the visualizer, but simply runs meteor with it until you kill meteor again. For production deployments use the meteor build command like below:

meteor build /tmp/output --directory

#4

Hmm, chai was the issue, not the bundle visualizer, but maybe that method could work for chai too!

meteor remove practicalmeteor:chai
meteor test --extra-packages practicalmeteor:chai

#5

Thanks!! That’s what i want.


#6

Also, chai can just be used directly from npm. practicalmeteor:chai is just an npm wrapper package (meaning the chai version you’re getting with that is probably also 3 years out of date!).