Dilan
Dilan

Reputation: 90

How to use Meteor packages in non-Meteor project

I have standard node.js REST API. And I want to use some meteor's packages like Minimongo, Tracker, Blaze (any Meteor's package)

There a lot of articles how use npm modules in Meteor but I have opposite task. Should I create some wrapper to make it possible to use as a Node modules?

There is similar question: How to use Meteor packages outside of Meteor? but nobody answer.

Upvotes: 1

Views: 187

Answers (2)

scrodrig
scrodrig

Reputation: 79

I just get the same issue so i look around perhaps it's too late However o found this https://www.npmjs.com/package/meteor-client-packages-meteor

Perhaps it could be helpful now

Or use this which the author recommends https://www.npmjs.com/package/meteor-webpack-client

Both are available..

Upvotes: 0

webdeb
webdeb

Reputation: 13211

this is a good question, but you cannot just use require for a meteor in npm. You also cannot use Drupal modules in in plain PHP, it will not work as in the context they are written for. Yes you can use npm packages in Meteor, but only because Meteor is build on top of Node, not vice-versa.

Meteor has its own packaging system, because Meteor Packages are Isomorph, they have the ability to share their code on client and server, like the SimpleSchema Package or many others. To make it simple for developers to use it, it's an complete encapsulated system.

But to your question. There are a some of really valuable "ports" of Meteor Packages to plain npm architecture. For example you mentioned Tracker, so there is a npm package for that.

... just to mention some...

To port a package you just need to extract the needed code, which don't depend on Meteor and other meteor packages and create a npm package of them.. So the code still behaves the same.. Just look at the Tracker code

You have to decide, why do you need meteor packages for your node/express application? And maybe there are already some better solutions in the npm world itself. If you really depend on major meteor packages, then just use Meteor ;)

Upvotes: 1

Related Questions