Skip to content

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

Open
meirzamoodle wants to merge 1 commit intomoodle:mainfrom
meirzamoodle:MDL-87922_import_map
Open

MDL-87922 [docs] Add guide for JavaScript import maps in Moodle#1529
meirzamoodle wants to merge 1 commit intomoodle:mainfrom
meirzamoodle:MDL-87922_import_map

Conversation

@meirzamoodle
Copy link
Contributor

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:

  • What an import map is and how the browser uses it
  • How Moodle builds and injects the import map via page_requirements_manager
  • The core\output\requirements\import_map class and its built-in specifiers (React, react-dom, jsx-runtime, and the Moodle design system)
  • How to register custom or plugin specifiers from a pre_render hook
  • The ESM serving endpoint and how it resolves external bundles vs component React builds
  • The HTTP caching strategy (immutable headers for versioned revisions, short-lived for -1 development mode)
  • How to author a component React module and expose it through the map
  • How to override a built-in specifier (e.g. swap in a debug React build)

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:
- What an import map is and how the browser uses it
- How Moodle builds and injects the import map via `page_requirements_manager`
- The `core\output\requirements\import_map` class and its built-in specifiers
  (React, react-dom, jsx-runtime, and the Moodle design system)
- How to register custom or plugin specifiers from a `pre_render` hook
- The ESM serving endpoint and how it resolves external bundles vs component
  React builds
- The HTTP caching strategy (immutable headers for versioned revisions,
  short-lived for `-1` development mode)
- How to author a component React module and expose it through the map
- How to override a built-in specifier (e.g. swap in a debug 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 2e8f4b7
🔍 Latest deploy log https://app.netlify.com/projects/moodledevdocs/deploys/69a38b4cad545d000853a6db
😎 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.

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.

1 participant