Getting this error when debugging 'widget.tsx' file:
import { AllWidgetProps, jsx, React } from 'jimu-core'; ^^^^^^ SyntaxError: Cannot use import statement outside a module at Object.compileFunction (node:vm:352:18) at wrapSafe (node:internal/modules/cjs/loader:1033:15) at Module._compile (node:internal/modules/cjs/loader:1069:27) at Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Object.require.extensions.<computed> [as .js] (C:\Users\arcgis-experience-builder-1.12\ArcGISExperienceBuilder\node_modules\ts-node\src\index.ts:16...) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"module": "CommonJS",
"moduleResolution": "node",
"target": "es6",
"esModuleInterop": true,
"lib": [
"dom",
"es6",
"scripthost"
],
"jsx": "react",
I've tried many suggestions from various sources but nothing works..
Any help on this will really be appreciated.
Thank you
Solved! Go to Solution.
I was able to resolve this by re-installation of npm & Node.js. I kept "type":"module" in package.json.
I was able to resolve this by re-installation of npm & Node.js. I kept "type":"module" in package.json.