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

   We're having a similar issue trying to import echarts into one of our 
components that's using ESM.
   
   I was able to work around it with some ugly imports that also seem to remove 
type safety. We've put this in a separate file to try to isolate this a little, 
small sample below, which might help others:
   
   ```
   import { LineChart, BarChart } from 'echarts/lib/export/charts.js';
   import { use } from 'echarts/lib/extension.js';
   import { init } from 'echarts/lib/core/echarts.js';
   import type { EChartsInitOpts, EChartsType } from 
"echarts/types/dist/echarts.js"
   
   export default function initaliseEcharts(dom?: HTMLElement | null, theme?: 
string | object | null, opts?: EChartsInitOpts) : Promise<EChartsType> {
       use([LineChart, BarChart ]);
   // any other use calls you want to make
       return init(dom, theme, opts);
   }
   ```
   
   This is obviously not ideal and would be interested in a proper fix in the 
library as well.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to