gpt4 book ai didi

jquery - 为什么 Meteor 1.4 加载 jQuery 1.11.2?

转载 作者:行者123 更新时间:2023-12-01 05:27:06 29 4
gpt4 key购买 nike

我在使用 React 在 Meteor 1.4 上使用 jQuery 时遇到了一个大问题。使用“meteor add jquery”安装 jQuery 时,它会安装 jQuery 1.11.9。对于某些包依赖项,我需要有更新版本的 jQuery。因此,我在 Meteor 下删除了 jQuery 1.11.9,并使用 npm 添加了 jQuery 2.1.4。两者似乎都已正确完成。

加载页面时,加载的 jQuery 文件表明其版本为 1.11.2。

这很令人费解。有人有同样的经历吗?有什么解决办法吗?

提前致谢!

最佳答案

我建议您阅读this thread

mxab 答案:

I'm also struggling with this issue. I'm trying to use fullcalendar from npm but it also contains which has a require("jquery")

This hack works for me so far:

1) adding my preferred jquery version via cdn into the html itself

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>

2) overriding the jquery package: packages/jquery/package.js:

Package.describe({
version: '1.11.6'
});

Package.onUse(function (api) {

api.use('modules-runtime');

api.export('$', 'client');
api.export('jQuery', 'client');
api.addFiles('index.js', ['client']);

});

packages/jquery/index.js:

//as we have it added as cdn in the head, jQuery is available
jQuery = window.jQuery;
$ = window.jQuery;


meteorInstall({
node_modules: {
jquery: function (r, e, module) {
module.exports = jQuery;
}
}
});

关于jquery - 为什么 Meteor 1.4 加载 jQuery 1.11.2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39156598/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com