Skip to content

Commit

Permalink
Add a comment about main script map lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
mstoykov committed Jul 18, 2022
1 parent 6b77bfc commit 7e289a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (b *Bundle) makeArchive() *lib.Archive {

// getExports validates and extracts exported objects
func (b *Bundle) getExports(logger logrus.FieldLogger, rt *goja.Runtime, options bool) error {
pgm := b.BaseInitContext.programs[b.Filename.String()]
pgm := b.BaseInitContext.programs[b.Filename.String()] // this is the main script and it's always present
exportsV := pgm.module.Get("exports")
if goja.IsNull(exportsV) || goja.IsUndefined(exportsV) {
return errors.New("exports must be an object")
Expand Down Expand Up @@ -263,7 +263,7 @@ func (b *Bundle) Instantiate(logger logrus.FieldLogger, vuID uint64) (*BundleIns
}

rt := vuImpl.runtime
pgm := init.programs[b.Filename.String()]
pgm := init.programs[b.Filename.String()] // this is the main script and it's always present
bi := &BundleInstance{
Runtime: rt,
exports: make(map[string]goja.Callable),
Expand Down

0 comments on commit 7e289a5

Please sign in to comment.