Meteor-Community-Packages / meteor-collection2

A Meteor package that extends Mongo.Collection to provide support for specifying a schema and then validating against that schema when inserting and updating.
https://packosphere.com/aldeed/collection2
MIT License
1.02k stars 108 forks source link

ReferenceError: SimpleSchema is not defined #374

Closed JackAdams closed 6 years ago

JackAdams commented 6 years ago

Up until now, I've been doing:

api.use('aldeed:collection2@2.10.0');
api.imply('aldeed:simple-schema');

in a local package to make sure that aldeed:collection2 and aldeed:simple-schema are available to the app. (SimpleSchema is a global in all files. I'm using the old directory structures without imports.)

If I change this to:

api.use('aldeed:collection2@3.0.0');
api.imply('aldeed:simple-schema');

(I know the imply line is now irrelevant in this scenario.)

and then:

meteor npm install --save simpl-schema

then, when trying to start the app, I get:

ReferenceError: SimpleSchema is not defined

for files used in the same local package. (i.e. later in the local package's package.json file, there are things like: api.addFiles('collections/groups.js'); and in that file SimpleSchema is being used as if it's globally available.)

Is there an easy way to make SimpleSchema a global while using aldeed:collection2@3.0.0?