/bug-es-module-shims-dynamic-import

Reproduction for dynamic import issues in es-module-shims

Primary LanguageHTML

bug-es-module-shims-dynamic-import

See open issue in es-module-shims guybedford/es-module-shims#471

Dirs "es-module-shims-v1" and "es-module-shims-v2" are identical, except a different version of the polyfill is loaded.

Steps to reproduce:

npm install
npm start

Install Firefox 107 from https://ftp.mozilla.org/pub/firefox/releases/107.0/ (or other browser without native import maps).

Open in Firefox 107:

Expected:

  • "scenario2" works
  • "scenario4" works not only in es-module-shims-v1, but also in es-module-shims-v2

Actual:

  • "scenario2" doesn't work, seems like a static import is necessary before the dynamic import to make it work (later shown in "scenario3" and "scenario4")
  • "scenario4" works in es-module-shims-v1, but not in es-module-shims-v2, seems like a regression in v2

"scenario3" and "scenario4" seem like a workaround, but it's probably needed due to how the polyfill is implemented.

"scenario4" is the closest to reality of my project where we have a chain of static imports and then a dynamic import for features hosted on the CDN.