mquandalle / meteor-bower

[DEPRECATED] Use bower packages in your Meteor app
http://bower.io/search/
MIT License
157 stars 28 forks source link

Server-side install? #65

Closed hartwoolery closed 9 years ago

hartwoolery commented 9 years ago

Is there a way to have bower include packages server side as well? For instance, I use the moment.js package on both client server, with some extended moment.fn functions, and I have to wrap it in a Meteor.isServer in order to not conflict with the fullcalendar dependency.

lorensr commented 9 years ago

Hey, sorry for the delay. You can use the multiple-install-location feature described at the end of the readme to have meteor-bower install some of your packages to your server/ folder.

nilnullzip commented 9 years ago

I am trying to use the "bitcore" package on both server and client. The client works as expected:

bitcore = require('bitcore') console.log(bitcore.Transaction().toString())

It seems the server works exactly the same. That's not really expected as usually we use Meteor.require() instead of require() when npm packages are installed via meteorhacks:npm.

Question: is the simple require() call the correct behavior for bower server install? Is there a possibility of incorrect operation or conflict with some other use of require()? (I'm thinking there was a reason that we are required to use Meteor.require() otherwise.)

Thanks! -Juan

lorensr commented 9 years ago

Hi Juan! I don't use require – the packages I use give me a global. The npm package just calls Meteor's Npm.require:

https://github.com/meteorhacks/npm/blob/master/plugin/init_npm.js#L86

which I don't think does anything special like wrapAsync or anything.

Also, update on server-side includes: you can use the new arch feature:

https://github.com/mquandalle/meteor-bower#limit-package-scope