clojurescript

danielneal 2025-12-30T16:03:12.444809Z

I’m looking for help with a Clojurescript / figwheel.main / webpack / highcharts issue. I’ve upgraded from highcharts 11 to 12. They’ve changed the way imports work - see https://www.highcharts.com/docs/getting-started/version-12 Previously, the following worked:

(ns my-project.core
  (:require 
    ["highcharts" :as Highcharts]
    ["highcharts/modules/heatmap" :as Heatmap]))

;; initialize the heatmap module
(Heatmap Highcharts) 
However since the upgrade, apparently the initialization is done ‘automatically’, but I don’t know enough how webpack works enough to understand what that means and what needs to change. Practically it means I get an error that seems to signify something didn’t load properly.
heatmap.js:9 Uncaught TypeError: Cannot read properties of undefined (reading 'Axis')
    at eval (heatmap.js:9:69)
    at eval (heatmap.js:9:204)
    at ./node_modules/highcharts/modules/heatmap.js (main_bundle.js:8380:1)
    at __webpack_require__ (main_bundle.js:10290:42)
    at eval (npm_deps.js:3:35)
I’m using figwheel.main 2.20 and cljs version 1.12.134. Any pointers would be so welcome, I’ve been banging my head against a wall (figuratively) for about a day now… it’s squarely in the domain of things I know I don’t know, but don’t know how to find clear information about.

danielneal 2025-12-30T17:18:41.177459Z

Switching to shadow-cljs from figwheel.main seems to have fixed the problem, but I’m none the wiser

thheller 2025-12-30T20:18:54.990519Z

I have never used highcharts, but my guess is that you are mixing es modules and commonjs files. the highcharts package ships both and my guess for ["highcharts" :as Highcharts] webpack picks the esm module, but ["highcharts/modules/heatmap" :as Heatmap] refers to a commonjs file

thheller 2025-12-30T20:19:10.449679Z

shadow-cljs on the other hand picks commonjs as the default, so both are commonjs and therefore fine

thheller 2025-12-30T20:20:17.516399Z

or your webpack config is just broken somehow. no clue, just guessing

thheller 2025-12-30T20:20:50.486229Z

there are some files in the es-modules folder in the package. dunno what they are for, but based my guess on that

danielneal 2025-12-30T20:45:18.918139Z

ah thanks that makes sense that it's a problem of mixing two sorts of modules. I didn't have a webpack config at all, just relied on whatever figwheel did there sounds like I might need to read up on that. I appreciate the pointers @thheller !