Mappings
moonlight uses mappings that automatically rename Webpack modules for you. You can import these modules into your extensions and use them, with a consistent module ID and unminified exports. It is suggested to look around the source of the mappings repository for a list of mapped modules.
Notable modules
react
: Reactdiscord/packages/flux
: Discord’s fork of Fluxdiscord/Dispatcher
: Discord’s Flux dispatcherdiscord/components/common/index
: A lot of components reused in the client
Using mappings in an extension
You can import and require mappings like any other module:
import Dispatcher from "@moonlight-mod/wp/discord/Dispatcher";// orconst Dispatcher = require("discord/Dispatcher").default;
Remember to add the module as a dependency.