不再使用6代的babel-plugin-transform-decorators-legacy。使用新的@babel/plugin-proposal-decorators

    1. {
    2. "plugins": [
    3. "@babel/plugin-transform-react-jsx",
    4. [
    5. "@babel/plugin-proposal-decorators",
    6. {
    7. "legacy": true
    8. }
    9. ],
    10. [
    11. "@babel/plugin-proposal-class-properties",
    12. {
    13. "loose": true
    14. }
    15. ]
    16. ]
    17. }

    对es6语法的支持

    1. "presets": [
    2. [
    3. "@babel/preset-env",
    4. {
    5. "modules": false,
    6. "targets": {
    7. "browsers": [
    8. "> 1%",
    9. "last 2 versions",
    10. "not ie <= 8"
    11. ]
    12. },
    13. "useBuiltIns": "usage"
    14. }
    15. ]
    16. ]