pixeldesu / moduleRaid

:gift: Taking apart webpackJsonp
MIT License
155 stars 45 forks source link

Uncaught Error: Unknown Webpack structure #20

Closed marcomow closed 1 year ago

marcomow commented 1 year ago

Hi! I've stumbled upon this error, the webpage is https://www.seb.lv/sites/default/files/calc/public/en/kma.html

The command I run

{
    const script = document.createElement('script');
    script.setAttribute('src', 'https://unpkg.com/moduleraid/dist/moduleraid.iife.js');
    script.addEventListener('load', () => window.mR = new ModuleRaid({debug:true}));
    document.head.appendChild(script);
}

The error:

moduleraid.iife.js:1 Uncaught Error: Unknown Webpack structure at o.fillModules (moduleraid.iife.js:1:1888) at new e (moduleraid.iife.js:1:1001) at HTMLScriptElement. (:4:55)

Debug info:

moduleraid.iife.js:1 [moduleRaid] Pushing moduleRaid.arrayArguments[0] into webpackJsonp failed: TypeError: window[t.entrypoint].push is not a function TypeError: window[t.entrypoint].push is not a function at https://unpkg.com/moduleraid/dist/moduleraid.iife.js:1:1662 at Array.forEach () at o.fillModules (https://unpkg.com/moduleraid/dist/moduleraid.iife.js:1:1562) at new e (https://unpkg.com/moduleraid/dist/moduleraid.iife.js:1:1001) at HTMLScriptElement. (:4:55)

moduleraid.iife.js:1 [moduleRaid] Pushing moduleRaid.arrayArguments[1] into webpackJsonp failed: TypeError: window[t.entrypoint].push is not a function TypeError: window[t.entrypoint].push is not a function at https://unpkg.com/moduleraid/dist/moduleraid.iife.js:1:1662 at Array.forEach () at o.fillModules (https://unpkg.com/moduleraid/dist/moduleraid.iife.js:1:1562) at new e (https://unpkg.com/moduleraid/dist/moduleraid.iife.js:1:1001) at HTMLScriptElement. (:4:55)

Maybe I'm doing something wrong with the configuration? Any suggestion?

pixeldesu commented 1 year ago

Unknown Webpack structure means it found an entrypoint, but any of the possible injection methods didn't work. So either it uses a newer one I haven't added yet, or something else is different about it.

Looking at the page, it indeed seems like that is a different webpackJsonp method. I'll take a look at it and see if I can add support for it.


Edit: 🎉 managed to get in! image


Edit 2: I actually already had this working, but it looks like I managed to break support for anything below Webpack 4 with a refactor. A single keyword missing broke half the injection methods.

pixeldesu commented 1 year ago

@marcomow Hey, I just released moduleRaid v6.0.1, a bugfix which should make this work again. Please tell me if the modules are detected now! (for your script, you might need to adjust the unpkg URL to load the actual version instead of the latest package, in case cache loads an older version)

marcomow commented 1 year ago

@pixeldesu incredibly quick reaction, thank you!

I can confirm it works also on my end. Only thing left: understanding how to reverse engineer the calculator functions 😅