highcharts / highcharts/highcharts-react
Bundled package imports highcharts.src.js
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 111
- Avg merge
- 9h 25m
- Merged PRs (30d)
- 2
Description
I'm a little confused about the structure of this repo, which appears to mostly be generated code, not original source files (which I assume are TypeScript? the tsconfig has a baseUrl of `src` which doesn't exist in this repo), so I apologize if I'm missing something. But here's the issue I'm encountering:
I'm using Vite and have Highcharts as a CDN dependency, so I'm using `setHighcharts` and then in my Vite config, `build.rollupOptions.external: ['highcharts']` – except that doesn't catch the import here: https://github.com/highcharts/highcharts-react/blob/d4189de37b509173700b730a3b7788c70f31ab3d/Highcharts.js#L27
So then I can update my `external` to `/^highcharts($|\/)/`. This works and resolves the import as external. However, I'm not using `.src.js` in my production code for what I imagine are obvious reasons, and so when it tries to import that package (even though it's not in _use_, the `import` is still being run) it errors. I'm working to try to override that import using `resolve.alias` but it's causing problems that I'm trying to chase down.
In the meantime I thought I'd raise this issue here: I would expect that, at least in the production code, in the bundled package, the import would simply be `import Highcharts from 'highcharts'`. In fact if that were the case, I _think_ I wouldn't have to use `setHighcharts` at all, because it would import the correct external to begin with.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.