I am new to ESBuild (and specifically using it via js.Build
) to create assets via pipes.
I have gotten it to work (yay!) and do what I want, with one exception: I cannot get “externals” to what I think it should do. I am not sure if I don’t understand Hugo’s js.Build
, or if I am not understanding ESBuild. (I’ll ask here since I always get such great help)
My JavaScript has an import:
import { spinnableObject, degToRad, doEuler, etScene, sliders } from "./eulerhelpers.js";
I would like this statement to remain in the bundled JS file. So, I do…
{{- $ext := (slice "./ethelpers.js" ) }}
{{- $js := resources.Get (printf "%s.js" (.Get 0)) | js.Build (dict "externals" $ext ) -}}
(I have also tried ethelpers.js
without the ./
and many other things).
But the contents of ethelpers.js
still gets bundled in my file. Everything is fine - except that the “externals” is being ignored.
I appreciate some hints as to why I am using “externals” wrong in js.Build
here.
(or, is there some other way for me to tell ESBuild "please use this include statement in the final result, rather than bundling)
Thank you!