Select to view content in your preferred language

Angular 19 build error with exports

371
6
11-26-2024 05:48 AM
SandroDevos
New Contributor

Hi,

Since updating to Angular 19, we get a build error regarding exports from within the @ArcGIS/core package.

 

node_modules/@arcgis/core/intl.d.ts:4:1 - error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.

4 export = intl;
~~~~~~~~~~~~~~
node_modules/@arcgis/core/geometry/projection.d.ts:4:1 - error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.

4 export = projection;

 

 

Package version of @angular is 19, errors happen on both `@arcgis/core` version 4.28.10 and version 4.31.6.

6 Replies
AndyGup
Esri Regular Contributor

Thanks for letting us know @SandroDevos. We've reproduced the issue and are looking into it. 

AndyGup
Esri Regular Contributor

@SandroDevos  in tsconfig.json, try setting skipLibCheck to true.

BillMitchell
Regular Contributor

I have also had this issue.  Setting skipLibCheck to true in tsconfig.json did not solve the issue.

10.53 ✘ [ERROR] TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. [plugin angular-compiler]
10.53
10.53     node_modules/@arcgis/core/geometry/geometryEngine.d.ts:4:0:
10.53       4 │ export = geometryEngine;
10.53         ╵ ~~~~~~~~~~~~~~~~~~~~~~~~
10.53
10.53
10.53 ✘ [ERROR] TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. [plugin angular-compiler]
10.53
10.53     node_modules/@arcgis/core/geometry/geometryEngineAsync.d.ts:4:0:
10.53       4 │ export = geometryEngineAsync;
10.53         ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10.53
10.53
10.53 ✘ [ERROR] TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. [plugin angular-compiler]
10.53
10.53     node_modules/@arcgis/core/geometry/projection.d.ts:4:0:
10.53       4 │ export = projection;
0 Kudos
JavidYousaf
New Contributor

I just updated a project to Angular 19 and am experiencing this same issue using the latest version of @ArcGIS/core (4.31.6):

 

✘ [ERROR] TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. [plugin angular-compiler]

    node_modules/@arcgis/core/core/reactiveUtils.d.ts:4:0:
      4 │ export = reactiveUtils;
        ╵ ~~~~~~~~~~~~~~~~~~~~~~~

Do you have a fix for this yet as I tried setting skipLibCheck to true in tsconfig.json but that didn't work.

 

0 Kudos
AndyGup
Esri Regular Contributor

@JavidYousafand @BillMitchell  can someone provide a minimal repro sample where skipLibCheck is true and you still see the errors? The core Angular sample is the best starting point: https://github.com/Esri/jsapi-resources/tree/main/core-samples/jsapi-angular-cli. Here's our recommendations for creating and sharing the sample: https://developers.arcgis.com/javascript/latest/troubleshooting/#minimal-reproducible-application.

0 Kudos
JavidYousaf
New Contributor

Hi @AndyGup I tried my application this morning and it worked - I still had the skipLibCheck enabled in tsconfig.json:

"skipLibCheck" = true

I think restating the console solved the issue, which I didn't do before, so as far as I can see your solution works.

My tsconfg.json looks like this now:

"compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    ..... 
    "skipLibCheck": true
  },

Thanks for your help!

0 Kudos