'React' was used before it was defined

前端 未结 14 2143
傲寒
傲寒 2020-12-29 19:28

I am working with create-react-app + typescript + eslint application and during build have such error:

Line 1:8:  \'React\' was used before it was defined  @t         


        
14条回答
  •  醉话见心
    2020-12-29 19:50

    (not enough rep to comment)

    @sashko's workaround seems to work - deleting node_modules was necessary as well.

    One thing I missed was the caret in "^4.0.1". The version needs to be fixed without the caret ^, which seems to be the issue that @Rolly is having. Make sure it's 4.0.1.

    Only a workaround until react-scripts updates to v4 (I'm using create-react-app)

提交回复
热议问题