@ babel / plugin-proposal-decorators无法正常工作

时间:2019-10-21 03:08:05

标签: babel

1,它是schema:DocumentShape a sh:NodeShape ; sh:targetClass schema:Document ; sh:property [ sh:path schema:isTargetOf ; sh:qualifiedMinCount 1 ; sh:qualifiedValueShape [ sh:class schema:HasAuthor ; ] ] ; sh:property [ sh:path schema:isTargetOf ; sh:qualifiedMinCount 1 ; sh:qualifiedValueShape [ sh:class schema:HasImage ; ] ] . umi:2.8.20"react": "^16.8.6""@babel/core": "^7.6.4"

2,babelrc:

webpack 4.41.2.

3个配置

{
  "presets": [
      [
          "@babel/preset-env",
          {
              "targets": {
                  "node": "current"
              }
          }
      ]
  ],
  "plugins": [

    [
      "@babel/plugin-proposal-decorators",
      {
        "legacy": true

      }
    ],
    ["@babel/plugin-proposal-class-properties", { "loose": true }],
    "@babel/plugin-transform-react-jsx",
    ]
}

4个问题:  语法错误:/Users/wangenfei/Desktop/workplace/lenovo/dpcTest/alita-simple-ui/src/components/header/header.jsx:当前未启用对实验语法“ decorators-legacy”的支持(142:1 ):

"jest": {
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/test/fileMock.js",
      "\\.(css|less|scss)$": "identity-obj-proxy",
      "^@/(.*)$": "<rootDir>/src/$1"
    },
    "transformIgnorePatterns": [
      "node_modules"
    ],
    "transform": {
      "^.+\\.js$": "babel-jest"
    }
  },

请帮助我!

0 个答案:

没有答案