Skip to main content

Helpful extensions

This is a list of helpful extensions that can be used to aid extension development.

Config options

These aren't extensions, but rather options in the moonlight config:

  • devSearchPaths: An array of directories to recursively search for built extensions (manifest.json).
    • When developing extensions, use the dist folder instead of the root folder. This is because the manifest.json resides in the root of the source code, but does not have the built files, which wastes time resolving files that will never exist.
  • loggerLevel: The level to log at. If not set, defaults to info.
  • patchAll: Set to true to wrap every Webpack module in a function. This slows down client starts significantly, but can make debugging easier.

Disable Sentry & No Track

Both of these extensions do not provide any utilities, but prevent your client from sending metrics to Discord, which lessens the risk of moonlight related errors being reported. These should always be enabled. These are not magical tools to prevent account suspension, and you should always consider safety when writing an extension (especially one that makes requests automatically).

Spacepack

Spacepack allows you to find and inspect Webpack modules. The "Add to global scope" setting is suggested, so you can use Spacepack from within DevTools.

  • require: Standard Webpack require.
  • inspect: Fetch a Webpack module by its ID and return an isolated copy of it, which can be double-clicked in DevTools to inspect the source code.
  • findByCode, findByExports: Returns an array of Webpack modules that has code/exports that match the arguments.
  • findObjectFromKey, findObjectFromValue, findObjectFromKeyValuePair, findFunctionByStrings: Search the exports of a Webpack module to find an object or function using the given arguments.
  • modules, cache: The Webpack modules and cache objects.