Intellij IDEA Ultimate - React App debugger exception


I have Intellij IDEA Ultimate IDE (2020.2.4) and I created a new React App project using npx create-react-app.

npm version is 6.14.9 and node.js version is v14.15.1.

After adding all the needed files I executed "npm start" and the pages ran successfully on chrome.

However, when I try to debug the app I encounter a few problems.

I added to package.json the following property:

"type": "module",

but now I get another error:

SyntaxError: Unexpected token '<'


I don't understand why I get it, without debugging using "npm start" the web page works well.

Looks like something related to Debugger configuration.

** When I use VsCode for debugging (instead on IntelliJ) everything works as expected.

Does anyone know how I can fix it ?

1 comment
Comment actions Permalink

It can hardly be related to debugger... I can't reproduce the issue with provided steps. What do you debug - your React application code or npm script the server is started with? What code the error is reported against? Please share a screenshot of the console with the error.

"type": "module"

tells node to treat files ending in .js as ES modules when passed to node as the initial input, or when referenced by import statements within ES module code; do you have any special reason for making the code executed with node (i.e. react scripts in case of application created with CRA) treated this way?


Please sign in to leave a comment.