pixeldesu / moduleRaid

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

moduleraid breaks when used in a Webpack v5 bundle #5

Closed eramdam closed 3 years ago

eramdam commented 3 years ago

What the title says 😅 For some reaosn the result of require('moduleraid') in an app bundled with Webpack v5 is an empty object.

See a repro in this repo https://github.com/eramdam/moduleraid-webpack5-repro

ScriptedAlchemy commented 3 years ago

There's significant changes to the runtime. V5 is a lot more robust so you might be able to access this with its api

eramdam commented 3 years ago

@ScriptedAlchemy the issue isn't that moduleraid can't access Webpack v5's package at runtime, which I would expect, but rather than using moduleraid in a Webpack 5 bundle results in the imported moduleraid code to not work/be an empty object 😅

EDIT: Weirdly enough, importing the source file directly into the codebase works fine, so I guess whatever is wrong lies in the dist file present in the npm package

tomer8007 commented 3 years ago

See this issue, it's fixed in @pedroslopez's fork.

eramdam commented 3 years ago

@tomer8007 Hum, it seems like @pedroslopez's fix allows moduleraid to inspect a webpack v5 bundle. My issue happens when bundling moduleraid in a webpack v5 bundle 😅

eramdam commented 3 years ago

This was fixed in 5.0.0 🎉