可以使用debundle它将Webpack和Browserify等工具生成的 javascript 编译代码反编译为它们的原始的代码和结果。
安装
npm i -g debundle
使用
debundle [input file] {OPTIONS}
选项:
--input, -i 反编译的js文件
--output, -o 反编译后存储的目录
--config, -c 配置文件
$ curl https://raw.githubusercontent.com/1egoman/debundle/master/test_bundles/browserify/bundle.js > bundle.js
$ curl https://raw.githubusercontent.com/1egoman/debundle/master/test_bundles/browserify/debundle.config.json > debundle.config.json
$ cat debundle.config.json
{
"type": "browserify",
"knownPaths": {}
}
$ debundle -i bundle.js -o dist/ -c debundle.config.json
$ tree dist/
dist/
├── index.js
└── node_modules
├── number
│ └── index.js
└── uuid
├── index.js
├── lib
│ ├── bytesToUuid.js
│ └── rng.js
├── v1.js
└── v4.js
4 directories, 7 files
配置文件
{
"type": "browserify",
"entryPoint": 1,
"knownPaths": {}
}
如何是webpack的话,将type中的browerify改为webpack
更多问题请查看 https://www.npmjs.com/package/debundle
网友回复