Skip to content

Instantly share code, notes, and snippets.

@nojvek
Created November 23, 2019 00:46
Show Gist options
  • Save nojvek/0a8dc90030cd65489dcaca9b329c9a87 to your computer and use it in GitHub Desktop.
Save nojvek/0a8dc90030cd65489dcaca9b329c9a87 to your computer and use it in GitHub Desktop.
webpackJsonp modules
moduleMap = {};
for (const p of webpackJsonp) {
const modules = p[1];
for (const [moduleName, moduleFn] of Object.entries(modules)) {
const moduleContent = moduleFn.toString();
const nameParts = moduleName.split(`!`);
const moduleId = nameParts[nameParts.length - 1] + (nameParts.length > 1 ? `!` : ``);
if (!moduleMap[moduleId]) {
moduleMap[moduleId] = moduleContent
} else if (moduleMap[moduleId] !== moduleContent) {
console.log(`diff ${moduleId}`);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment