TypeScript & Babel All In One_TypeScriptTypeScript & Babel All In One



TypeScript & Babel All In One

TypeScript & Babel All In One_JSX_02

$ yarn add -D @babel/cli @babel/core @babel/preset-env @babel/preset-typescript



TypeScript & Babel All In One_tsx_03

{
"presets": [
["@babel/preset-env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"@babel/preset-react"
],
"plugins": [
"lodash",
"@babel/plugin-transform-runtime",
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties",
"@babel/plugin-syntax-dynamic-import",
"react-hot-loader/babel",
[
"import",
{
"libraryName": "antd",
"style": true
}
]
]
}

{

"@babel/core": "7.8.0",
"@babel/eslint-parser": "7.11.4",
"babel-loader": "8.1.0",
"babel-plugin-import": "1.13.0",
"babel-plugin-lodash": "3.3.4",
"@babel/plugin-syntax-dynamic-import": "7.8.3",
"@babel/plugin-proposal-class-properties": "7.10.4",
"@babel/plugin-proposal-decorators": "7.10.5",
"@babel/plugin-transform-runtime": "7.11.0",
"@babel/preset-env": "7.11.0",
"@babel/preset-react": "7.10.4",
"@babel/runtime": "7.11.2",

}


TypeScript & Babel All In One_JSX_04

new react project

babel 7+

TypeScript & Babel All In One_TypeScript

babel

old react project

babel 6-

tsc + babel

TypeScript & Babel All In One_React_06

TypeScript & Babel All In One_React_07

TypeScript & Babel All In One_JSX_08