moduleRaid is a utility to get modules and module constructors from webpackJsonp
functions (or similar endpoints) embedded on websites by Webpack. It also provides functions to search through returned modules.
You can get moduleRaid over npm
$ npm install moduleraid
Or if you directly want to use it in the browser
<script src="https://unpkg.com/moduleraid/dist/moduleraid.iife.js"></script>
Or alternatively, just copy the contents from above unpkg link into the devtools console on a website!
Using moduleRaid
as a module, simply require and execute it somewhere where it will end up as a public facing script on a page that also
includes a Webpack build!
import ModuleRaid from 'moduleRaid'
const mR = new ModuleRaid()
Now, with the mR
instance available and modules being fetched, you can use the two available find*()
methods to search for modules!
let results = mR.findModule('coolFeature')
// => Array of fitting modules for the search query
let constRes = mR.findConstructor('_internal')
// => Array of fitting constructor/module tuples for the search query
// after moduleRaid has been set up you can now listen for new chunks being loaded
document.addEventListener('moduleraid:webpack-push', (e) => {
// e.detail contains the arguments push() was called with
// your code here...
})
For more in-depth documentation around what you can use of moduleRaid, you can visit the API Documentation!
webcrack
, of which the initial module extraction was based onmoduleRaid is licensed under the MIT License