I’ve got a Npm.depends
for a module that’s only needed server side in a local Meteor package.
Two questions:
- Does that mean the npm module code goes into the client bundle as well?
- If so, how do I stop that from happening, but still have it available to an
Npm.require
in theserver/methods.js
file (see below)?
Note: this is an old-style Meteor app with no imports and globals everywhere
My package.json
looks like this:
Package.describe({
name: 'my-package',
version: '0.0.1',
summary: 'Used on client and server in multiple apps',
});
Npm.depends({
'aws-sdk': '2.499.0'
});
Package.onUse(function(api) {
api.versionsFrom('1.1.0.2');
// BOTH
api.addFiles('lib/config.js');
api.addFiles('lib/functions.js');
api.addFiles('lib/methods.js');
// CLIENT
api.addFiles('client/lib/_main.js', 'client');
api.addFiles('client/lib/subscriptions.js', 'client');
api.addFiles('client/lib/blaze_helpers.js', 'client');
// SERVER
api.addFiles('server/publications.js', 'server');
api.addFiles('server/methods.js', 'server'); // ONLY THIS FILE USES AWS-SDK
api.export(['VariousSymbolsUsedOnBothClientAndServer']);
});