【发布时间】:2019-01-19 22:57:41
【问题描述】:
这个:
babel ./src/MyTypescript.ts --out-dir ./wwwroot/js/
不起作用(没有错误,只是'0已编译')。
.babelrc 包含 Babel 7 使用 webpack babel loader 编译 typescript 所需的所有内容:预设“@babel/typescript”和插件“babel-plugin-transform-class-properties”(对我来说适用于当前的 babel 7 rc01).
【问题讨论】:
-
为什么要在 typescript 中使用 babel?为什么不简单地使用 typescript 编译器?
-
只是为了研究和调试(从bundle中提取转译的TS代码相当复杂)
-
如果 somobody 可以向我解释 @babel/typescript 是错误(或好)的想法,我会非常高兴。现在这个困境“用什么 tsc 或预设” - 让我瘫痪。
-
@AkashKava:this post 详细说明了为什么您只想使用 Babel 7,而不使用 TypeScript(但使用 TypeScript 插件)。
标签: typescript babeljs babel-loader