git clone https://github.com/awareride/packscope.git
cd packscope
npm install
# Unpack a local bundle
npx packscope ./dist/app.js ./out
# Or from a URL
npx packscope https://example.com/app.js ./out
Features
What Packscope gives you
One file per module
Each webpack/rspack module is written to modules/<id>.js. ES-module chunks go to chunks/ and original sources to sources/.
Executable by default
The loader reconstructs the original bundle shape using the real UMD header and webpack runtime, so the unpacked tree runs identically.
Edit & rebuild
Modify any module, then run node out/rebuild.js bundle-edited.js to regenerate a single runnable bundle.
Unpack from URLs
Pass an http:// or https:// URL. Packscope downloads the bundle, resolves chunks, and rewrites imports to local paths.
Manifest & dependency graph
manifest.json contains IDs, sizes, dependency edges, inferred names, and downloaded assets for further analysis.
Optional beautify & rename
Use --beautify and --rename for readable output. Defaults keep original slices for guaranteed execution.
FAQ
Frequently asked questions
Which bundlers does Packscope support?
webpack, rspack, rollup, esbuild, and Vite — the two major bundle families, one file per module or one file per chunk.
Does the unpacked tree actually run?
Yes. The loader reconstructs the original bundle shape using the real UMD header and webpack runtime verbatim, so the unpacked tree runs identically to the original bundle.
Can I edit modules and rebuild?
Modify any module file, then run node out/rebuild.js bundle-edited.js to regenerate a single runnable bundle.
Why would I want to unpack a bundle at all?
To audit what actually ships to users, debug production-only issues by editing modules, learn how popular libraries are structured, or patch third-party bundles without the original source.
Packscope is a Node CLI that unpacks a single (“mono”) JavaScript bundle into a navigable, executable project tree. Production bundles are opaque — a single 20 MB file with thousands of minified modules. Packscope gives you one file per module, a loader that reconstructs the original bundle shape, and a rebuild script that stitches your edits back into a single runnable bundle.
It handles the two major bundle families:
- webpack-style (webpack, rspack) — one file per module in
modules/<id>.js. - ES module (rollup, esbuild, Vite) — one file per chunk in
chunks/<name>.js.
Use it to audit what’s actually shipped to users, debug production-only issues, learn how popular CLI tools and libraries are structured, or patch third-party bundles without access to the original source.