Webpack
Webpack
is a utility class for getting internal webpack modules. Instance is accessible through the BdApi. This is extremely useful for interacting with the internals of Discord.
Properties
Filters
Series of Filters to be used for finding webpack modules.
Type: Filters
Methods
getBulk
Finds multiple modules using multiple filters.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
queries | ...object | ❌ | none | Object representing the query to perform |
queries.filter | function | ❌ | none | A function to use to filter modules |
queries.first | Boolean | ✅ | true | Whether to return only the first matching module |
queries.defaultExport | Boolean | ✅ | true | Whether to return default export when matching the default export |
queries.searchExports | Boolean | ✅ | false | Whether to execute the filter on webpack exports |
Returns: any
getModule
Finds a module using a filter function.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
filter | function | ❌ | none | A function to use to filter modules. It is given exports, module, and moduleID. Return true to signify match. |
options | object | ✅ | none | Options to configure the search |
options.first | Boolean | ✅ | true | Whether to return only the first matching module |
options.defaultExport | Boolean | ✅ | true | Whether to return default export when matching the default export |
options.searchExports | Boolean | ✅ | false | Whether to execute the filter on webpack exports |
Returns: any
waitForModule
Finds a module that is lazily loaded.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
filter | function | ❌ | none | A function to use to filter modules. It is given exports. Return true to signify match. |
options | object | ✅ | none | Options for configuring the listener |
options.signal | AbortSignal | ✅ | none | AbortSignal of an AbortController to cancel the promise |
options.defaultExport | Boolean | ✅ | true | Whether to return default export when matching the default export |
options.searchExports | Boolean | ✅ | false | Whether to execute the filter on webpack exports |
Returns: Promise.<any>