I have a project with two modules chart.js
and slider.js
, and slider imports a class from chart. Now I want to bundle both with Rollup.js.
My rollup config looks like this
export default {
input: [
'src/chart.js',
'src/slider.js'
],
output: {
format: 'es',
dir: 'dist'
},
};
When I run Rollup, it produces 3 files instead of 2: chart.js, slider.js, and additionally, chart-DqLRgW92.js. The last file actually contains my Chart class exporting it under a different name:
export { Chart as a };
And then chart.js only renames the export back to Chart:
export { a as Chart } from './chart-DqLRgW92.js';
There is nothing else in the chart.js except this single line.
slider.js imports Chart from chart-DqLRgW92.js:
import { C as Chart } from './chart-DqLRgW92.js';
On the other hand, if I run Rollup separately on each entry file, it produces a single output for each entry. Is there a way to setup Rollup to generate two output files and export the Chart class from chart.js without renaming it back and forth?