Review main Merged

72619[TASK] Use ES11 import syntax for dynamic typescript imports

Benjamin Franzke CR +2 V +2 Normal +53 −42 updated 12/13/21, 12:28

Commit message

ECMAScript 2020 (ES11) introduced dynamic imports.
TypeScript offers automatic type checking and resolution
for the dynamic import syntax (when using static strings)
and is able to transpile to require() calls in AMD output mode.

Therefore all occurences where a require() is used
directly, are migrated to the import syntax.

Notes:

* This change has a slight drawback: the generated code
  is slighter in order to add runtime detections for
  ES6 vs AMD style default.
  Although, this only applies in TypeScript AMD mode and
  will be compensated once switching to native ES6 modules.

* top.require() calls are left as-is for now, as this cases
  can't be changed to top.import():
    Property 'import' does not exist on type 'Window'
  Also something isn't available in native ES11 imports:
    TypeError: top.import is not a function

  We'll rather need a messaging api between the frames that
  allows to load top-level modules via import() in future.

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 2

Files 31

Show 11 more files