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

Error: did not recognize object of type "AssignmentPattern" #13

Closed extesy closed 6 years ago

extesy commented 6 years ago

@1egoman I get this error while running debundle on a webpack (non-minified) bundle:

.....
* No lookup tabie for module 510, so using identifier as require path...
* 510 => 510
assert.js:42
  throw new errors.AssertionError({
  ^

AssertionError [ERR_ASSERTION]: did not recognize object of type "AssignmentPattern"
    at getFieldNames (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/types.js:581:12)
    at Object.exports.eachField (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/types.js:611:5)
    at NodePath.traverse (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/traverse.js:42:15)
    at NodePath.Pp.each (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/path.js:89:22)
    at traverse (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/traverse.js:30:18)
    at /usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/traverse.js:48:13
    at /usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/types.js:612:18
    at Array.forEach (<anonymous>)
    at Object.exports.eachField (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/types.js:611:27)
    at traverse (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/traverse.js:42:15)
1egoman commented 6 years ago

Huh. Not sure what's going on there, but it looks like it's either a bug in escodegen or acorn (whichever one uses the module ast-types that's referenced in that stack trace). Also, is that the whole stack trace? It seems like there might be some lines missing from the bottom.

extesy commented 6 years ago

Yes, that's the whole stacktrace. I was able to fix that locally by bumping all dependency versions and updating cloned replacer module from using "traverse" to "visit".

1egoman commented 6 years ago

Closed due to inactivity

zauker commented 6 years ago

Hi, I have the same issue:

AssertionError [ERR_ASSERTION]: did not recognize object of type "AssignmentPattern"
    at getFieldNames (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/types.js:581:12)
    at Object.exports.eachField (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/types.js:611:5)
    at NodePath.traverse (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/traverse.js:42:15)
    at NodePath.Pp.each (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/path.js:89:22)
    at traverse (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/traverse.js:30:18)
    at /usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/traverse.js:48:13
    at /usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/types.js:612:18
    at Array.forEach (<anonymous>)
    at Object.exports.eachField (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/types.js:611:27)
    at traverse (/usr/local/lib/node_modules/debundle/node_modules/ast-types/lib/traverse.js:42:15)

I have installed debundle globally as version 0.5.4 and I have node and npm version v8.11.3 and 5.6.0

@extesy could you explain to me how did you fix it?

extesy commented 6 years ago

@zauker update this package's package.json file to use latest dependency versions and then update its cloned replacer module from using "traverse" function to "visit".

isbur commented 5 years ago

@extesy Thanks! It worked out for me well too

crazybooot commented 2 years ago

Hi @extesy @isbur @1egoman could you please add a bit more instructions of how could yow resolve this issue? Many thanks