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:
|
import HC from "highcharts/esm/highcharts.src.js"; |
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.
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
srcwhich 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
setHighchartsand then in my Vite config,build.rollupOptions.external: ['highcharts']– except that doesn't catch the import here:highcharts-react/Highcharts.js
Line 27 in d4189de
So then I can update my
externalto/^highcharts($|\/)/. This works and resolves the import as external. However, I'm not using.src.jsin 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, theimportis still being run) it errors. I'm working to try to override that import usingresolve.aliasbut 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 usesetHighchartsat all, because it would import the correct external to begin with.