When I am trying to debug my react application, it gives me the following error SyntaxError: Cannot use import statement outside a module for the import React from 'react' statement. I've searched google but there are different ways and I couldn't find something related to react.
Asked
Active
Viewed 149 times
0
-
2Can you provide the code, what you've tried so far? – Avishka Dambawinna Apr 24 '20 at 11:16
-
Can you please share the code which has the mentioned issue? Thanks! – norbitrial Apr 24 '20 at 11:22
-
I cannot actually share the code, it is a very large project. Can you tell me what are the possible scenarios of this occurence – Gowthamss Apr 24 '20 at 11:51
-
how do you compile the project? create-react'aap, webpack + babel,..,... Check also the extension of the file. Sometimes there are mistakes between .js/.ts and .jsx/.tsx – Jerome Apr 24 '20 at 11:59
-
The extension of the file is .js and it is the entry point in webpack.config – Gowthamss Apr 24 '20 at 12:14
-
https://stackoverflow.com/a/62790930/2899767 – knopch1425 Jul 08 '20 at 08:48