如何使用 babel 7 cli 编译 typescript?

Rom*_*kij 1 typescript babeljs babel-loader

这:

babel ./src/MyTypescript.ts  --out-dir ./wwwroot/js/
Run Code Online (Sandbox Code Playgroud)

不起作用(没有错误,只是“0 已编译”)。

.babelrc包含 Babel 7 使用 webpack babel loader 编译 typescript 所需的一切:预设“@babel/typescript”和插件“babel-plugin-transform-class-properties”(对我来说适用于当前的 babel 7 rc01)。

Rom*_*kij 5

这是一个答案:

 babel ./src/MyTypescript.ts  --out-dir ./wwwroot/js/ --extensions '.ts,.js'
Run Code Online (Sandbox Code Playgroud)