且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Meteor 中使用本地客户端库?

更新时间:2022-06-22 00:46:08

你不应该手动弄乱 .meteor 目录中的文件(除了 packages>release 文件),这是 Meteor 放置其编译文件的地方.所有库都应该转到源文件夹 - 所以基本上是其他任何地方.

You shouldn't manually mess with files in .meteor directory (except for packages and release files), that's where Meteor puts its compiled files. All libraries should go to source folder - so basically anywhere else.

我假设这些是客户端库.

I assume those are client-side libraries.

在那种情况下,把它们:

In that case, put them:

  • /client 中,如果它们何时加载并不重要并且它们碰巧在那里工作;
  • /client/lib 中,如果您需要在其余代码之前加载它们;
  • /client/compatibility 中,如果代码未准备好与 Meteor 一起使用,并且您不想/不知道如何修复它;
  • /client/lib/compatibility 中,如果上述两种情况都发生.为了安全起见,我建议一开始就把它们放在这里.
  • in /client if it doesn't matter when they are loaded and they happen to work there;
  • in /client/lib if you need to load them before the rest of the code;
  • in /client/compatibility if the code is not prepared to work with Meteor and you don't want to / don't know how to fix it;
  • in /client/lib/compatibility if both of the above conditions occur. I'd recommend to put them here on the beginning just to be safe.