FormidableLabs / inspectpack

An inspection tool for Webpack frontend JavaScript bundles.
MIT License
592 stars 20 forks source link

Support NamedModulePlugin and `eval()` source map modes #30

Closed tptee closed 7 years ago

tptee commented 7 years ago

The NamedModulePlugin uses string file paths as module IDs, so we can no longer assume that all Webpack IDs are integers (which... 😢 🤔 😞 ). Technically, module IDs can be anything since plugins can manipulate them; however, the NamedModulePlugin is the only common deviation I've seen in the wild.

The parser no longer coerces ID strings to numbers, and actions now assume string IDs. I broke up the parser into a few files in service of this (some heuristics for extracting module IDs grew).

The parser now extracts the "real" code from within the eval() wrapper when run in certain source map modes. It also strips out any inline source maps so that they don't skew module sizes.