如何在typescript文件位于'./src'时构建输出文件夹
How to build to output folder when the typescript files are located in './src'
我有什么:
./src/myfile.ts
./test/mytest.spec.ts
和tsc应该在./build
位置创建一个javascript (myfile.js
)和定义文件(myfile.d.ts
)。
:
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"rootDir": ".",
"outDir": "./build",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"declaration": true
},
"files": [
"./src/index.ts"
],
"exclude": [
".vscode",
".git",
"build",
"node_modules",
"test"
],
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
但是这个配置文件在./build/src/
子文件夹中生成myfile.js
。
请注意,我不能使用"rootDir": "./src"
,因为测试文件夹没有被编译(这会在使用karma + webpack运行测试时产生问题?)
TypeScript没有很好地建模来处理绑定。这是你应该用其他工具来做的 <标题>更多h1> Webpack快速入门:https://basarat.gitbooks.io/typescript/content/docs/quick/browser.html并且tsc应该在。/build位置创建一个javascript (myfile.js)和定义文件(myfile. d.s ts)。
不推荐out
/outFile
: https://basarat.gitbooks.io/typescript/content/docs/tips/outFile.html
相关文章:
- 我应该如何从xml文件构建一个javascript页面
- 如何在DOM元素上按类型构建此函数
- 在Twitter上用ie9中的空白src访问iframe的contentWindow
- Javascript:使用绝对路径设置img src
- Sencha Touch构建-排除文件
- 子字符串/正则表达式以获取字符串中保存的 SRC 值
- Javascript将图像src更改为淡入淡出
- RubyonRails——构建交互式接口应该朝哪个方向发展
- 如何使用Angular动态添加iframe-src
- //而不是在src=“”上使用http://"属性
- 如何在构建node-webkit应用程序后获取外部资源
- 使用:new Image()控制加载html.src=html_URL
- 无法使用nodeJS在html中设置Image src
- Ext.js从json构建模型关系的问题
- 如何动态更改脚本src
- 在不设置协议的情况下,使用javascript/jquery更改iframe-src
- 如何为生产构建angular2应用程序
- 为什么当我尝试为iframe-src属性构建URL时,AngularJS会抛出错误
- Gulp:从src目录到build目录的构建过程
- 如何在typescript文件位于'./src'时构建输出文件夹