Skip to content

MDL-87922 [docs] Add guide for JavaScript import maps in Moodle#1529

Merged
abgreeve merged 2 commits intomoodle:mainfrom
meirzamoodle:MDL-87922_import_map
Mar 11, 2026
Merged

MDL-87922 [docs] Add guide for JavaScript import maps in Moodle#1529
abgreeve merged 2 commits intomoodle:mainfrom
meirzamoodle:MDL-87922_import_map

Conversation

@meirzamoodle
Copy link
Contributor

@meirzamoodle meirzamoodle commented Mar 1, 2026

Adds a new documentation page explaining how Moodle uses native browser import maps to resolve bare module specifiers (e.g. react, @moodle/lms/) to real URLs at runtime.

The guide covers:

  • Import map basics and runtime specifier resolution
  • How page_requirements_manager builds/injects the map
  • core\output\requirements\import_map responsibilities and built-in specifiers
    (@moodle/lms/, @moodlehq/design-system, react, react/, react-dom)
  • Registering custom/plugin specifiers via pre_render hooks
  • ESM endpoint routing and resolution behavior (including longest-prefix matching)
  • Component module resolution for @moodle/lms//
  • Cache strategy for revisioned assets vs revision -1 development mode
  • How to expose component React modules through js/esm/build
  • Overriding built-in specifiers (e.g. custom React build)

@netlify
Copy link

netlify bot commented Mar 1, 2026

Deploy Preview for moodledevdocs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 43ca9fe
🔍 Latest deploy log https://app.netlify.com/projects/moodledevdocs/deploys/69b106606915e50008fedb6f
😎 Deploy Preview https://deploy-preview-1529--moodledevdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@meirzamoodle meirzamoodle force-pushed the MDL-87922_import_map branch 2 times, most recently from 63e249b to 6702f4d Compare March 4, 2026 14:25
Adds a new documentation page explaining how Moodle uses native browser import maps to resolve bare module specifiers (e.g. react, @moodle/lms/) to real URLs at runtime.

The guide covers:
- Import map basics and runtime specifier resolution
- How page_requirements_manager builds/injects the map
- core\output\requirements\import_map responsibilities and built-in specifiers
  (@moodle/lms/, @moodlehq/design-system, react, react/, react-dom)
- Registering custom/plugin specifiers via pre_render hooks
- ESM endpoint routing and resolution behavior (including longest-prefix matching)
- Component module resolution for @moodle/lms/<component>/<module>
- Cache strategy for revisioned assets vs revision -1 development mode
- How to expose component React modules through js/esm/build
- Overriding built-in specifiers (e.g. custom React build)
@meirzamoodle meirzamoodle force-pushed the MDL-87922_import_map branch from 6702f4d to 55f86dd Compare March 4, 2026 14:27
@abgreeve abgreeve self-requested a review March 11, 2026 05:26
Copy link
Contributor

@abgreeve abgreeve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Meirza,
Thanks for the quick update. This is looking good now.

@abgreeve abgreeve added this pull request to the merge queue Mar 11, 2026
Merged via the queue into moodle:main with commit 5defff5 Mar 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants