I have a module which depends on cal-heatmap. In this module, I'm importing cal-heatmap via esm
import CalHeatmap from "cal-heatmap";
...
I'm bundling this module with webpack using the umd target and because I do not want the bundle size of the module to be large, I've externalize cal-heatmap.
Externalizing cal-heatmap causes it to be referenced in the module using the commonjs syntax, require("cal-heatmap");
But when I use the exported module in my project, the reference to cal-heatmap breaks the project. After hours of hair-pulling, I noticed that the global d3, d3-selection, d3-color and d3-fetch externalized in cal-heatmap is the root source of the issue. They are all undefined when imported with commonjs syntax
I have a module which depends on cal-heatmap. In this module, I'm importing cal-heatmap via esm
I'm bundling this module with webpack using the umd target and because I do not want the bundle size of the module to be large, I've externalize
cal-heatmap
. Externalizing cal-heatmap causes it to be referenced in the module using the commonjs syntax,require("cal-heatmap")
;But when I use the exported module in my project, the reference to
cal-heatmap
breaks the project. After hours of hair-pulling, I noticed that the global d3, d3-selection, d3-color and d3-fetch externalized incal-heatmap
is the root source of the issue. They are allundefined
when imported with commonjs syntax