We have a Preact app using the Preact-cli with Typescript template
The tsconfig.json is configured exactly per here: https://developers.arcgis.com/javascript/latest/typescript-setup/
ArcGIS API 4.18 states we can compile with just ES Modules: https://community.esri.com/t5/arcgis-api-for-javascript/build-error-with-typescript/m-p/1035951#M72025
In my TS file I have:
import EsriMap from "@arcgis/core/Map";
and in my componentDidMount I have:
const testMap = new EsriMap({ basemap: "streets-night-vector" });However, when I build I continue to get the following error and the app fails to compile:
✖ ERROR ../node_modules/@arcgis/core/core/workers/WorkerFallback.js 167:20 Module parse failed: Unsyntactic break (167:20) File was processed with these loaders: * ../node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | }); | > break; | } catch ($boundEx) { | return $error($boundEx);
I also get the following warning (which is not as severe but needs attention):
⚠ WARN ../node_modules/@arcgis/core/core/workers/workers.js 67:37-46 Critical dependency: the request of a dependency is an expression @ ../node_modules/@arcgis/core/views/3d/support/WorkerHandle.js @ ../node_modules/@arcgis/core/layers/support/LercDecoder.js @ ../node_modules/@arcgis/core/layers/ElevationLayer.js @ ../node_modules/@arcgis/core/portal/Portal.js @ ../node_modules/@arcgis/core/Basemap.js @ ../node_modules/@arcgis/core/Map.js @ ./services/esri/esri.service.ts @ ./components/base-map/base-map.tsx @ ./components/app.tsx @ ./index.ts @ ../node_modules/preact-cli/lib/lib/entry.js
NOTE: everything works fine when I go the esri-loader route, however, we do not want to use that as we are planning for compile ES Modules and prefer to move away from AMD.
Any idea what the issue is here?
Thanks in advance...
</code></pre><P> </P><P> </P><P> </P><P> </P><pre class="lia-code-sample language-javascript"><code>