systemjs: Race condition with
Under the following conditions, systemjs throws an error:
- Using named-register extra
<script type="systemjs-module" src="./index.js">in document before system.js is loaded- The module loaded via
type=systemjs-modulehas a dependency on another module.
If the module depended on is in the import map, you get this error:

If the module depended on is a url instead of bare module specifier, you get this error:

About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (8 by maintainers)
Commits related to this issue
- Waiting for extras before loading systemjs-module scripts. Resolves #2040 — committed to systemjs/systemjs by adboomlodestar 5 years ago
- Fix for named-register extra. Resolves #2040. — committed to systemjs/systemjs by adboomlodestar 5 years ago
Very close:
<script type=systemjs-module>above the script that loads systemjs does not wait for extras.<script type=systemjs-module>below the script that loads systemjs does wait for extras (via this DOMContentLoaded listener).So basically putting it below the systemjs script is a bit worse for perf, but always works. Putting it above the systemjs script is better for perf, but doesn’t work with extras.