【发布时间】:2017-07-18 18:12:31
【问题描述】:
我正在尝试开始使用 Typescript 进行 Electron 开发。在与 node 和 jquery 的输入搏斗之后,我终于让我的 .ts 文件没有错误了。
现在的问题是,当我运行我的应用程序时,我收到了这个错误:
index.js:2 Uncaught ReferenceError: exports is not defined
这些是 index.js 中的前两行:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
我不知道那条线会。 Typescript 在编译时添加了它。如果我删除它,我的应用可以正常工作。
如何摆脱这个错误?
哦,这是我的 tsconfig,如果相关的话。
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"isolatedModules": false,
"jsx": "react",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"declaration": false,
"noImplicitAny": false,
"noImplicitUseStrict": false,
"removeComments": true,
"noLib": false,
"preserveConstEnums": true,
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"node_modules",
"typings/browser",
"typings/browser.d.ts"
],
"compileOnSave": true,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
【问题讨论】:
标签: javascript typescript