我正在使用电子框架开发应用程序。我的项目结构如下。
project
|----scripts
| |----model.ts
| |----view.ts
| |----controller
| |----tsconfig.json
|----index.html
|----style.css
|----main.js
|----node_modules
|----package.json
在打字稿文件中,我正在导入一些模块,如下面的
import fs = require("fs");
import Electron = require("electron");
我用不同的tsconfig.json
设置编译了它。我希望能够在index.html
中包含已编译的java脚本文件。这是我使用的示例tsconfig.json
。我为module
选项尝试了不同的值。
{
"compilerOptions": {
"module" : "amd",
"target": "es5",
"outFile" : "result.js",
"sourceMap": true
},
"exclude": [
"node_modules"
]
}
我总是得到exports
是未定义的引用或define
是未定义的引用等。我真的想使用typescript而不是普通的java-script。我在堆栈溢出方面经历了很多类似的问题但无济于事。