pixeldesu / moduleRaid

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

TypeError: Cannot read properties of undefined (reading 'length') #23

Open ViZiD opened 11 months ago

ViZiD commented 11 months ago

The error occurred on https://ivan-stoychev.com/ and a couple of other sites where entrypoint starts with webpackJsonpreact-*

Debug info:

Entrypoint has been detected at window.webpackJsonpreact-tours and set for injection

[moduleRaid] Pushing moduleRaid.arrayArguments[0] into webpackJsonpreact-tours failed: TypeError: Cannot read properties of undefined (reading 'length') TypeError: Cannot read properties of undefined (reading 'length') at t (https://ivan-stoychev.com/:1:1261) at Array.r [as push] (https://ivan-stoychev.com/:1:1186) at https://unpkg.com/moduleraid/dist/moduleraid.iife.js:1:1742 at Array.forEach () at n.fillModules (https://unpkg.com/moduleraid/dist/moduleraid.iife.js:1:1642) at new e (https://unpkg.com/moduleraid/dist/moduleraid.iife.js:1:1075) at HTMLScriptElement. (:4:55)

[moduleRaid] Pushing moduleRaid.arrayArguments[1] into webpackJsonpreact-tours failed: TypeError: Cannot read properties of undefined (reading 'length') TypeError: Cannot read properties of undefined (reading 'length') at t (https://ivan-stoychev.com/:1:1261) at Array.r [as push] (https://ivan-stoychev.com/:1:1186) at https://unpkg.com/moduleraid/dist/moduleraid.iife.js:1:1742 at Array.forEach () at n.fillModules (https://unpkg.com/moduleraid/dist/moduleraid.iife.js:1:1642) at new e (https://unpkg.com/moduleraid/dist/moduleraid.iife.js:1:1075) at HTMLScriptElement. (:4:55)

Error:

Uncaught Error: Unknown Webpack structure at n.fillModules (moduleraid.ts:211:15) at new e (moduleraid.ts:148:10) at HTMLScriptElement. (:4:55

pixeldesu commented 11 months ago

Hmm, to give a status update on this, I actually have no idea how to solve this problem specifically.

There's a method in the runtime that "somehow" (?) isn't accessible after the intended chunks are loaded, so injecting a new one doesn't work.

I tried a few options already and haven't found a workaround for this yet. So it technically failing with Unknown Webpack structure is correct here 😄

Your issue states other websites also have this, could you list some more examples?

ViZiD commented 11 months ago

Hi! The sites I mentioned have authorization, and there is no English localization. I have something better, I did a little digging and found out that applications built with create-react-app version 3.x and 4.x look the same, the same structure, and the same error. I did eject on version 3.4.1 and deployed the redux toolkit counter app to the cloudflare page link to repo Maybe this will help...