Reputation: 143
How do I achieve the same functionality on the server side that the client/compatibility folder provides on the client side.
I have files with lots of old js functions that are defined as:
function functionName() {...}
I need to access these from my new server side Meteor code but because they are in different files and Meteor gives each file its own namspace they aren't in scope.
I could force each library function to be global by changing the declaration to:
functionName = function() {...}
but this is impractical as I don't own or maintain the js functions.
To prevent this wrapping on the client side you can place the js file in the folder client/compatibility. How do I prevent this wrapping server side? server/compatibility doesn't seem to work. Neither does creating a package and using api.export()
Upvotes: 1
Views: 110
Reputation: 27763
By default meteor wraps each js file to give it it's own namespace.
That's not accurate. If you make a file /client/lib/something.js
and put this in it:
GlobalObject = {};
Then GlobalObject
will be accessible throughout the entire project.
Can you edit your question to be more specific? What are you trying to achieve exactly? Can you post some code?
Upvotes: 0