That particular issue had it’s continuation in this topic:
i.e. a similar issue cropped up with Rollup.
If I remember correctly it boiled down to (incorrect) mixing of JS module formats.
Rollup is ESM oriented, while Brunch needs CJS - so you have tweak the Bucklescript transpilation configuration accordingly.
In Rollup’s case, it was bothered by the transpiled (CJS-version) of phoenix.js
and much happier with the non-transpiled ESM-version of phoenix.js
.
So it wouldn’t surprise me one bit if success with webpack depends largely on getting the various output JS module formats all correctly lined up.