Commit ceabaa74 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Improve startup sequence when there are no JS modules present.

parent 87ed9519
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1715,7 +1715,12 @@ func evalRuntimeModules(rp *RuntimeProviderJS, modCache *RuntimeJSModuleCache, m
	r := goja.New()

	// TODO: refactor and simplify modCache
	if len(modCache.Names) == 0 {
		// There are no JS runtime modules to run.
		return nil, nil, nil
	}
	modName := modCache.Names[0]

	initializer := NewRuntimeJavascriptInitModule(logger, modCache.Modules[modName].Ast, announceCallbackFn)
	initializerValue := r.ToValue(initializer.Constructor(r))
	initializerInst, err := r.New(initializerValue)