定義我添加的JQuery在打字稿,但我有此錯誤:出口不打字稿
Uncaught ReferenceError: exports is not defined
代號TS:
import * as $ from 'jquery'
$('.test').click(function(eventObject){
alert('med');
})
代碼JS:
"use strict";
exports.__esModule = true;
var $ = require("jquery");
$('.test').click(function (eventObject) {
alert('med');
});
tsconfig.json :
{
"compilerOptions": {
"target": "es5",
"module": "es6",
"pretty": true,
"experimentalDecorators":true
},
"files": [
"demo.ts",
"typings/index.d.ts"
],
"excluse": ["node_modules"]
}
如何解決這個bug?
試圖您可以發佈您tsconfig文件? – rgvassar
你從哪裏得到這個錯誤? – unional
你有安裝'@ types/jquery'和'jquery' npm包嗎? – msanford