问题描述
我想将momentjs与流星一起使用.这是一个npm软件包,所以据我所知,它不能与流星一起使用,因为流星使用它自己的软件包系统.所以这是我的问题:
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 here are my questions:
- 有人知道在流星上使用momentjs的方法吗?
- 有没有办法在流星上使用npm软件包?
2017编辑:从Meteor 1.4+开始,npm软件包管理允许标准导入npm模块和命名导入的Atmosphere模块.
2017 EDIT: As of Meteor 1.4+, npm package management allows for standard imports of npm modules and named imports of Atmosphere modules.
推荐答案
对于独立的js库,例如moment.js,validate.js,underscore.string.js等,您只需将源文件放入lib
文件夹.我将client/lib
用于仅在客户端上使用的库(例如validate.js),并将lib
用于可以同时在客户端和服务器上使用的库(例如moment.js).
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.
使用流星的npm模块是很多人问的问题(有充分的理由).您可以在此处看到一些笔记,尽管我首先听说过流星与npm软件包的对话方式即将发生重大变化.
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.
这篇关于如何在Meteor中使用`moment.js`?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!