You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "spliffone (via GitHub)" <gi...@apache.org> on 2025/06/24 06:13:19 UTC

Re: [I] [Bug] Compatibility with ESM [echarts]

spliffone commented on issue #20554:
URL: https://github.com/apache/echarts/issues/20554#issuecomment-2998956105

   We face a similar issue after upgrading to Angular 20 which come with a new typescript version 5.8.0. The `ng build` is failing with the following error:
   
   ```bash
   ✘ [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/echarts/index.d.ts:23:0:
         23 │ export = echarts;
            ╵ ~~~~~~~~~~~~~~~~~
   ```
   
   Since we use bundler with target es2022 the only workaround I found is to add `skipLibCheck`:
   
   ```json
   {
     ...
     "compilerOptions": {
       "module": "es2022",
       "moduleResolution": "Bundler",
       "target": "es2022",
       "skipLibCheck": true,
       ...
     }
   }
   ```
   
   But I believe it is better to adjust the types file `https://github.com/apache/echarts/blob/master/index.d.ts`:
   
   ```diff
   ...
   - import * as echarts from './types/dist/echarts';
   + export * from './types/dist/echarts'
   // Export for UMD module.
   export as namespace echarts;
   - export = echarts;
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org