How to use `moment.js` with Meteor?

前端 未结 5 550
青春惊慌失措
青春惊慌失措 2020-12-06 11:28

I am wanting to use momentjs with meteor. This is an npm package, so from what I understand, it cannot be used with meteor because meteor uses it\'s own package system. So

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-06 12:16

    For stand-alone js libraries like moment.js, validate.js, underscore.string.js, etc. you can just drop the source file into your lib folder. I use client/lib for libraries which will be used only on the client (like validate.js), and lib for libraries which could be used by both the client and the server (like moment.js).

    If you use meteorite, you can take advantage of the atmosphere packages. Some of what you are looking for for may be in there.

    Using npm modules from meteor is something a lot of people ask about (for good reason). You can see some notes here, though I heard first hand that the way meteor talks to npm packages is about to change significantly.

提交回复
热议问题