如何使用 babel 7 cli 编译打字稿?
How to compile typescript with babel 7 cli?
这个:
babel ./src/MyTypescript.ts --out-dir ./wwwroot/js/
不起作用(没有错误,只是“0 编译”)。
.babelrc
包含 Babel 7 使用 webpack babel loader 编译打字稿所需的一切:预设“@babel/typescript”和插件 "babel-plugin-transform-class-properties"(对我来说适用于当前的 babel 7 rc01).
这是一个答案:
babel ./src/MyTypescript.ts --out-dir ./wwwroot/js/ --extensions '.ts,.js'
所选答案不适合我。
我已经在以下 link 的帮助下解决了:
https://github.com/microsoft/TypeScript-Babel-Starter/blob/master/package.json
"build:js": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline"
要添加 TS 扩展:
--extensions \".ts,.tsx\"
这个:
babel ./src/MyTypescript.ts --out-dir ./wwwroot/js/
不起作用(没有错误,只是“0 编译”)。
.babelrc
包含 Babel 7 使用 webpack babel loader 编译打字稿所需的一切:预设“@babel/typescript”和插件 "babel-plugin-transform-class-properties"(对我来说适用于当前的 babel 7 rc01).
这是一个答案:
babel ./src/MyTypescript.ts --out-dir ./wwwroot/js/ --extensions '.ts,.js'
所选答案不适合我。
我已经在以下 link 的帮助下解决了:
https://github.com/microsoft/TypeScript-Babel-Starter/blob/master/package.json
"build:js": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline"
要添加 TS 扩展:
--extensions \".ts,.tsx\"