出口不打字稿
问题描述:
定义我添加的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