Skip to content

Commit 7de5317

Browse files
committed
js/esbuild: Add runners after scripts
1 parent 4cbd4ef commit 7de5317

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

internal/js/esbuild/batch.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -476,18 +476,10 @@ func (b *batcher) doBuild(ctx context.Context) (*Package, error) {
476476

477477
for _, g := range b.scriptGroups.Sorted() {
478478
keyPath := g.id
479-
var runners []scriptRunnerTemplateContext
480-
for _, vv := range g.runnersOptions.ByKey() {
481-
runnerKeyPath := keyPath + "_" + vv.Key().String()
482-
runnerImpPath := paths.AddLeadingSlash(runnerKeyPath + "_runner" + vv.Compiled().Resource.MediaType().FirstSuffix.FullSuffix)
483-
runners = append(runners, scriptRunnerTemplateContext{opts: vv, Import: runnerImpPath})
484-
addResource(g.id, runnerImpPath, vv.Compiled().Resource, false)
485-
}
486479

487480
t := &batchGroupTemplateContext{
488481
keyPath: keyPath,
489482
ID: g.id,
490-
Runners: runners,
491483
}
492484

493485
instances := g.instancesOptions.ByKey()
@@ -521,6 +513,13 @@ func (b *batcher) doBuild(ctx context.Context) (*Package, error) {
521513
t.Scripts = append(t.Scripts, bt)
522514
}
523515

516+
for _, vv := range g.runnersOptions.ByKey() {
517+
runnerKeyPath := keyPath + "_" + vv.Key().String()
518+
runnerImpPath := paths.AddLeadingSlash(runnerKeyPath + "_runner" + vv.Compiled().Resource.MediaType().FirstSuffix.FullSuffix)
519+
t.Runners = append(t.Runners, scriptRunnerTemplateContext{opts: vv, Import: runnerImpPath})
520+
addResource(g.id, runnerImpPath, vv.Compiled().Resource, false)
521+
}
522+
524523
r, s, err := b.client.buildBatchGroup(ctx, t)
525524
if err != nil {
526525
return nil, fmt.Errorf("failed to build JS batch: %w", err)

0 commit comments

Comments
 (0)