This is probably not a common issue, but I’m hoping if someone tell me whether my solution is best practice.
I have a js file that resides in my /private folder. It needs to be separate from the Meteor application. This .js file takes in a string parameter and I use a number of packages (like xml2js and async - “Error finding module”) to parse this data. The data is used somewhere else and theres no problems accessing and running this file.
When I’m developing I can add the xml2js and async packages to my Meteor package.json and this works great.
However, I have finally created a build for production using the custom deployment https://guide.meteor.com/deployment.html#custom-deployment
Heres the problem. It seems that on the production build, I end up having issues with accessing the required npm packages (xml2js & asymc). I’m guessing that the private folder (or the “app/programs/server/assets/app” folder) cannot access those required files?
I ended up taking the whole node_modules folder from “/programs/server/npm” and copying it to the “programs/server/assets/app” folder. Once I did that it worked fine.
I am thinking I could have just grabbed the specific libraries and created a new node_modules folder. I’ll probably be trying that tonight. My question is… should I be able to access these npm packages declared in the Meteor app in a Production build? If not, can I create a separate package.json file just for the private directory for whatever npm packages it needs? Is this the best way to go about this problem? Do I need to manually build this out after I do my “meteor build”?