<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SyntaxError: Cannot use import statement outside a module (TypeScript) in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/syntaxerror-cannot-use-import-statement-outside-a/m-p/1388524#M6958</link>
    <description>&lt;P&gt;I was able to resolve this by re-installation of npm &amp;amp; Node.js. I kept&amp;nbsp;&lt;SPAN&gt;"type":"module"&amp;nbsp;in package.json.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Feb 2024 04:57:45 GMT</pubDate>
    <dc:creator>GeeteshSingh07</dc:creator>
    <dc:date>2024-02-29T04:57:45Z</dc:date>
    <item>
      <title>SyntaxError: Cannot use import statement outside a module (TypeScript)</title>
      <link>https://community.esri.com/t5/developers-questions/syntaxerror-cannot-use-import-statement-outside-a/m-p/1387846#M6956</link>
      <description>&lt;P&gt;Getting this error when debugging 'widget.tsx' file:&lt;/P&gt;&lt;DIV class=""&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;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.&amp;lt;computed&amp;gt; [as .js] (&lt;A target="_blank"&gt;C:\Users\arcgis-experience-builder-1.12\ArcGISExperienceBuilder\node_modules\ts-node\src\index.ts:1608:43&lt;/A&gt;) 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 &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;FONT color="#FF0000"&gt;source-map-support.js:726&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I have tried modifying package.json (adding/removing "type":"module" &amp;amp; tsconfig.json , tried&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;"module" as various parameters, but nothing works.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "module": "CommonJS",
    "moduleResolution": "node",
    "target": "es6",
    "esModuleInterop": true,
    "lib": [
      "dom",
      "es6",
      "scripthost"
    ],
    "jsx": "react",&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried many suggestions from various sources but nothing works..&lt;/P&gt;&lt;P&gt;Any help on this will really be appreciated.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 05:08:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/syntaxerror-cannot-use-import-statement-outside-a/m-p/1387846#M6956</guid>
      <dc:creator>GeeteshSingh07</dc:creator>
      <dc:date>2024-02-28T05:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: SyntaxError: Cannot use import statement outside a module (TypeScript)</title>
      <link>https://community.esri.com/t5/developers-questions/syntaxerror-cannot-use-import-statement-outside-a/m-p/1388524#M6958</link>
      <description>&lt;P&gt;I was able to resolve this by re-installation of npm &amp;amp; Node.js. I kept&amp;nbsp;&lt;SPAN&gt;"type":"module"&amp;nbsp;in package.json.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 04:57:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/syntaxerror-cannot-use-import-statement-outside-a/m-p/1388524#M6958</guid>
      <dc:creator>GeeteshSingh07</dc:creator>
      <dc:date>2024-02-29T04:57:45Z</dc:date>
    </item>
  </channel>
</rss>

