aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-12-14 11:56:00 +0100
committerBjørn Erik Pedersen <[email protected]>2024-12-16 08:33:10 +0100
commit7de5317aef7866ed559f0dbcd2f3370944b30ed6 (patch)
tree94b44a37997289b1d37251527109e773548ddb8b /internal
parent4cbd4ef9913d9d167eec7dda029f4fe6f3b22bd8 (diff)
downloadhugo-7de5317aef7866ed559f0dbcd2f3370944b30ed6.tar.gz
hugo-7de5317aef7866ed559f0dbcd2f3370944b30ed6.zip
js/esbuild: Add runners after scripts
Diffstat (limited to 'internal')
-rw-r--r--internal/js/esbuild/batch.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/internal/js/esbuild/batch.go b/internal/js/esbuild/batch.go
index 688b58d21..d0b6dba33 100644
--- a/internal/js/esbuild/batch.go
+++ b/internal/js/esbuild/batch.go
@@ -476,18 +476,10 @@ func (b *batcher) doBuild(ctx context.Context) (*Package, error) {
for _, g := range b.scriptGroups.Sorted() {
keyPath := g.id
- var runners []scriptRunnerTemplateContext
- for _, vv := range g.runnersOptions.ByKey() {
- runnerKeyPath := keyPath + "_" + vv.Key().String()
- runnerImpPath := paths.AddLeadingSlash(runnerKeyPath + "_runner" + vv.Compiled().Resource.MediaType().FirstSuffix.FullSuffix)
- runners = append(runners, scriptRunnerTemplateContext{opts: vv, Import: runnerImpPath})
- addResource(g.id, runnerImpPath, vv.Compiled().Resource, false)
- }
t := &batchGroupTemplateContext{
keyPath: keyPath,
ID: g.id,
- Runners: runners,
}
instances := g.instancesOptions.ByKey()
@@ -521,6 +513,13 @@ func (b *batcher) doBuild(ctx context.Context) (*Package, error) {
t.Scripts = append(t.Scripts, bt)
}
+ for _, vv := range g.runnersOptions.ByKey() {
+ runnerKeyPath := keyPath + "_" + vv.Key().String()
+ runnerImpPath := paths.AddLeadingSlash(runnerKeyPath + "_runner" + vv.Compiled().Resource.MediaType().FirstSuffix.FullSuffix)
+ t.Runners = append(t.Runners, scriptRunnerTemplateContext{opts: vv, Import: runnerImpPath})
+ addResource(g.id, runnerImpPath, vv.Compiled().Resource, false)
+ }
+
r, s, err := b.client.buildBatchGroup(ctx, t)
if err != nil {
return nil, fmt.Errorf("failed to build JS batch: %w", err)