1egoman / debundle

:card_file_box: A javascript debundler. Takes a Browserify or Webpack bundle and recreates the initial, pre-bundled source.
https://www.npmjs.com/package/debundle
705 stars 145 forks source link

Module AST Failed #10

Closed imerkle closed 6 years ago

imerkle commented 6 years ago
Reading bundle...
/usr/local/lib/node_modules/debundle/src/index.js:80
    throw new Error(`Locating the module AST failed. Please specifify a valid manual ast path in your config file with the key \`moduleAst\`. We got as far as ${moduleAstPathTriedSoFar.join('.')} before an error occured.`);
    ^

Error: Locating the module AST failed. Please specifify a valid manual ast path in your config file with the key `moduleAst`. We got as far as body.0.expression.arguments before an error occured.
1egoman commented 6 years ago

https://github.com/1egoman/debundle/blob/master/DOCS.md#moduleast

You're going to need to put your bundle into a tool like astexplorer.net to figure out where the modules are inside.

gregsadetsky commented 6 years ago

Hey @1egoman, thank you for this amazing tool! Commenting on this issue since this is the most recent occurence of this problem.

I just successfully unbundle'd a webpack bundle, and had to use the following moduleAst:

"moduleAst": ["body", 0, "expression", "argument", "arguments", 0]

This is different than the default configuration (which doesn't have the extra "argument" in it as above).

I'm wondering if this could help explain some of the ast issues? Could webpack be using the configuration above in some circumstances?

Thanks!

1egoman commented 6 years ago

@gregsadetsky Yea, potentially. I just went with the defaults that running the command-line webpack produced, but I have definitely run across bundles that are webpack produced and are different.

Unfortunately, I'm not a webpack expert and don't know why that is, so I made it configurable. Thanks for mentioning it though, someday it'd be neat if there was a way to auto-detect a module list in a bundle so none of this would be an issue. 😄

gardinermichael commented 5 years ago

Hi there,

I'm attempting to debundle this file:

https://github.com/projectestac/wordpress-tinymce-advanced/blob/master/dist/classic-paragraph.js

I'm receiving the following error:

$ debundle -i bundle.js -o dist/ -c debundle.config.json
* Using default AST location for webpack...
* Reading bundle...
/Users/michael/.npm-packages/lib/node_modules/debundle/src/index.js:80
    throw new Error(`Locating the module AST failed. Please specifify a valid manual ast path in your config file with the key \`moduleAst\`. We got as far as ${moduleAstPathTriedSoFar.join('.')} before an error occured.`);
    ^

Error: Locating the module AST failed. Please specifify a valid manual ast path in your config file with the key `moduleAst`. We got as far as body.0.expression.arguments before an error occured.
    at Object.<anonymous> (/Users/michael/.npm-packages/lib/node_modules/debundle/src/index.js:80:11)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

My config file is:

{
  "type": "webpack",
  "entryPoint": 0,
  "knownPaths": {}
}
draobrehtom commented 4 years ago

Hi there,

I'm attempting to debundle this file:

https://github.com/projectestac/wordpress-tinymce-advanced/blob/master/dist/classic-paragraph.js

I'm receiving the following error:

$ debundle -i bundle.js -o dist/ -c debundle.config.json
* Using default AST location for webpack...
* Reading bundle...
/Users/michael/.npm-packages/lib/node_modules/debundle/src/index.js:80
    throw new Error(`Locating the module AST failed. Please specifify a valid manual ast path in your config file with the key \`moduleAst\`. We got as far as ${moduleAstPathTriedSoFar.join('.')} before an error occured.`);
    ^

Error: Locating the module AST failed. Please specifify a valid manual ast path in your config file with the key `moduleAst`. We got as far as body.0.expression.arguments before an error occured.
    at Object.<anonymous> (/Users/michael/.npm-packages/lib/node_modules/debundle/src/index.js:80:11)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

My config file is:

{
  "type": "webpack",
  "entryPoint": 0,
  "knownPaths": {}
}

` $ debundle --input index.js --output dist/ --config config.json

Error: Locating the module AST failed. Please specifify a valid manual ast path in your config file with the key moduleAst. We got as far as body.0.expression.arguments before an error occured. at Object. (C:\Users\danylo\scoop\persist\nodejs\bin\node_modules\debundle\src\index.js:80:11) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:643:32) at Function.Module._load (internal/modules/cjs/loader.js:556:12) at Function.Module.runMain (internal/modules/cjs/loader.js:839:10) at internal/main/run_main_module.js:17:11 `

tbaltrushaitis commented 3 years ago

@1egoman,

any updates on this :point_up: ?

Thank you in advance!

1egoman commented 3 years ago

@tbaltrushaitis This project is no longer maintained: https://github.com/1egoman/debundle#dragon-here-be-dragons-dragon

Sorry about that.