-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Description
ESBuild is a very fast JavaScript bundler written in Go. It would be nice if in addition to minifying out of the box, Hugo could also bundle JS files.
Usage might looks like:
{{ $jsOptions := dict "minify" true "sourceMap" false "module" true }}
{{ $js := resources.Get "js/entrypoint.js" | toJSBundle $jsOptions | fingerprint }}
<script type="module" src='{{ $js.RelPermalink }}'></script>And entrypoint.js could import files in the ES6 style:
import { onLoad } from './utils.js';
import myFunc from './my-func.js';
onLoad(myFunc);With all the concatenation and tree shaking happening automatically.
budparr, onedrawingperday, KevinGimbel, vilterp, satotake and 2 morejlfwong