I've run into a problem with my React application, so I'm trying to debug. Normally, the application runs as expected, but when I try to run the app within the debugger, the following error is thrown:
Uncaught SyntaxError %FILEPATH%/src/index.js:1 import React from 'react'
SyntaxError: Cannot use import statement outside a module
This SO post asked about a similar problem, but I only receive the error message when using the debugger. Not at any other time. Last time, I had an error while debugging, it was a problem with my launch.json
file. I am assuming the problem might be similar, but I need help figuring it out.
My current launch.json
file looks like this:
{
"version": "0.2.0",
"configurations": [
{
"command": "npm start",
"name": "Run npm start",
"request": "launch",
"type": "node-terminal"
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"cwd": "${workspaceFolder}\\frontend\\src",
"program": "${workspaceFolder}\\frontend\\src\\index.js"
}
]
}
Also, I'm using the node.js debugger that comes built into VSCode