Skip to content

Feature request: ESBuild pipeline #7321

@earthboundkid

Description

@earthboundkid

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions