import Session from "./Session.js";

let session = new Session();

loadPlugins()
  .then(() => session.connect());

async function loadPlugins()
{
  let pluginEntryScripts = <%- JSON.stringify(entryScripts) %>;
  let importPromises = [];

  for(let entryScript of pluginEntryScripts) {
    let importPromise = import(entryScript).then(loadPlugin);

    importPromises.push(importPromise);
  }

  await Promise.all(importPromises);
}

function loadPlugin(module)
{
  module.default(session);
}
import Session from "./Session.js";
<% for(let i = 0; i < entryScripts.length; i++) { -%>
import { default as plugin<%- i %> } from "<%- entryScripts[i] %>";
<% } -%>

let session = new Session();

loadPlugins()
  .then(() => session.connect());

async function loadPlugins()
{
<% for(let i = 0; i < entryScripts.length; i++) { -%>
  plugin<%- i %>(session);
<% } -%>
}

Remove dynamic import in client source
Remove dynamic import in client source
