Using esbuild for Moodle Plugin AMD Modules
Use esbuild to modernise AMD module workflows in a Moodle plugin while staying compatible with Moodle’s runtime expectations.
Summary: This guide shows how to use esbuild as a lightweight build tool for Moodle plugin AMD modules while still producing Moodle-compatible output.
This is a focused alternative to the heavier traditional Grunt workflow. The key is not esbuild itself. The key is generating output that still conforms to Moodle’s AMD expectations.
Keep the Moodle AMD contract intact
You still need the normal Moodle structure:
amd/src/for sourceamd/build/for generated output
Using esbuild does not change how Moodle loads modules. It only changes how you compile them.
Set up a small local toolchain
The SOP’s flow is:
npm init -y
npm install --save-dev esbuild
Then create a build script that compiles the source files into AMD-compatible built assets in amd/build/.
Use esbuild for speed, not for unnecessary complexity
The advantage of esbuild here is that it is fast and simple. If you start layering a large frontend pipeline on top of a small Moodle plugin, you often lose the operational benefit that made esbuild attractive in the first place.
Solin specializes in Moodle plugin development workflows and modern build tooling. Need help? Contact us.
Solin supports modern front-end build workflows in Moodle plugins, including AMD, bundling, and deployment-safe tooling. Need help? Contact us.
Contact us