xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

TypeScript & Babel All In One

TypeScript & Babel All In One

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


{
    "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",

}

new react project

babel 7+

babel

old react project

babel 6-

tsc + babel

refs



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2021-04-04 09:17  xgqfrms  阅读(62)  评论(9编辑  收藏  举报