尝试导入错误:“默认"未从“../assertThisInitialized/_index.mjs"导出

问题描述:

突然我的反应是应用程序抛出这个错误

Suddenly my react is application throwing this error

./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
Attempted import error: 'default' is not exported from '../assertThisInitialized/_index.mjs'.

早些时候它可以工作,但今天它抛出错误

Earlier it was working but today it is throwing error

package.json

package.json

"react": "^16.8.6",      
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.2",
"babel-jest": "^24.8.0",
"babel-loader": "^7",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-runtime": "^6.26.0",
"webpack": "^4.35.3",

我得到了解决方案.添加@babel/runtime@7.5.0";在 package.json 的决议下强制 babel-preset-react-app 使用 @babel/runtime@7.5.0

I got the solution. Add "@babel/runtime@7.5.0" under resolutions in package.json to force babel-preset-react-app to use @babel/runtime@7.5.0

 "resolutions": {
    "**/@babel/runtime": "7.5.0"
  },