gpt4 book ai didi

jquery - SystemJS:加载 jQuery

转载 作者:行者123 更新时间:2023-12-01 04:40:05 26 4
gpt4 key购买 nike

我正在使用 Angular2,并且我想包含 jQuery。

systemjs.config.js

(function (global) {
System.config({
paths: {
'npm:': 'node_modules/',
'jquery': "//code.jquery.com/jquery-2.1.4.min.js"
},
meta: {
bootstrap: {
deps: ['jquery']
}
},
.....
}

app.module.ts中,我收到错误:当我输入时找不到模块“jquery”:

import $ from 'jquery';

我尝试使用 map 而不是路径,但结果相同..

最佳答案

正确的代码是..

import * as $ from 'jQuery';

您还应该映射到 CDN 吗?

什么时候不通过 NodeJS 获取 jQuery 或在本地保存 jQuery 并映射到它?

关于jquery - SystemJS:加载 jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40236090/

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