场景:

  架构:React+TS+DVA

    具体场景: 在将之前后缀为jsx的组件转化为tsx后缀的组件时,抛出Cannot read property 'createElement' of undefined

  Cannot read property 'createElement' of undefined

 解决方案:

  在tsconfig.json中添加配置

"esModuleInterop": true
"allowSyntheticDefaultImports": true

  作用:允许导入符合es6模块规范的CommonJS模块。

 

相关文章:

  • 2021-07-09
  • 2021-12-02
  • 2022-01-06
  • 2021-08-12
  • 2021-12-24
  • 2022-02-15
  • 2021-10-09
  • 2022-12-23
猜你喜欢
  • 2021-05-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2021-11-22
相关资源
相似解决方案