当前位置: 动力学知识库 > 问答 > 编程问答 >

npm - Importing jquery with JSPM in Aurelia app. Build errors

问题描述:

Could anyone help me solve my build errors. Trying to build aurelia app with gulp. But importing jquery doesn't work straight away.

import $ from 'jquery';

gives me an error

src\examples\datatablesExample.ts(1,8): error TS1192: Module '"jquery"' has no default export.

typings\jquery\jquery.d.ts(3210,13): error TS2403: Subsequent variable declarations must have the same type. Variable '$' must be of type 'cssSelectorHelper', but here has type 'JQueryStatic'.

So I'm importing jquery as follows

import * as $ from 'jquery';

Can anyone explain why some guys can import jquery straight away, but I can't? Also what is the second error about, is it something jquery has mixed up?


Just trying to figure out jspm with aurelia, jquery and other modules.

网友答案:

after you have installed jquery by

 jspm install jquery 

try to load jquery by

import 'jquery';

But ensure that you are in root dir of your project when you execute the jspm command. After installing i would suggest to make a clean and a gulp build command again before you use the methods.

分享给朋友:
您可能感兴趣的文章:
随机阅读: