Intillij Debugging - SyntaxError: Cannot use import statement outside a module Follow
This seems similar to some other questions but in their cases they're doing things differently than I.
When trying to debug or run a reactjs project with Intillij I receive the following message on run:
import logo from './logo.svg';
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1084:15)
at Module._compile (node:internal/modules/cjs/loader:1119:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
I left the debug config to default with:
In vscode I have the following debug config which does work:
"name": "Launch Chrome against localhost",
All the code for my react app is in ./src. Apologies - I suspect I'm missing something obvious but it's not clear to me based on the error message what it is.
Please sign in to leave a comment.
In hindsight, that is amazingly obvious. I really appreciate your taking the time to answer that for a noob. Been giving myself a massive crash course in frontend dev and it has been a lot to put together but now that you say it... it's one of those "duh" moments.
Thanks again for taking the time to respond. I really appreciate it - you guys are the best.