Hello,
I have this new error : attachSchema is not a function
I suppose this is from the update of aldeed:collection2 from 3.5.0 to 4.0.0.
I do not see any breaking change here : https://github.com/Meteor-Community-Packages/meteor-collection2/blob/master/CHANGELOG.md#400-beta.3
Do you know if something has changed ?
Thanks
1 Like
Yes, there is a change. In v4.0.0 you need to explicitly import Collection2 (either statically or dynamically). See here: Import using static imports
1 Like
Is there any way to use the dynamic imports instead?
Seems odd to have this new feature but be unable to use it
Hey what seems to be the problem you experience? My understanding:
- if you only use it server side (like I do), you importat the static server side. It has to be imported before any reference to it so one of the places is the top of server/main.js
- if you need it client side, you import the static as above and then import the dynamic at the top of your client perhaps client/main.js? But one thing to consider on the client side …
If you have a home page that doesn’t require DB queries, you probably could have it imported further down, behind a login. If your home page/url requires DB queries through this library, you can very well include it in the bundle and deliver the bundle through CDN rather than having multiple calls to bring the necessary code. This is only a “problem” for the first visit of a bundle version. Second visits come from browser cacheing of your bundle JS and/or the dynamically loaded code.
Unfortunately the documentation is not too explicit so this is based mostly on my understanding.