rollup / rollup-plugin-commonjs

This module has moved and is now available at @rollup/plugin-commonjs / https://github.com/rollup/plugins/blob/master/packages/commonjs
MIT License
502 stars 126 forks source link

Throw an error on invalid patterns #353

Closed guybedford closed 4 years ago

guybedford commented 6 years ago

Trying to debug the following bug report:

{ TypeError: extractors[element.type] is not a function
    at /tmp/5cc2a5ec/rollup/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js:241:43
    at Array.forEach (<anonymous>)
    at Object.ArrayPattern (/tmp/5cc2a5ec/rollup/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js:240:17)
    at extractNames (/tmp/5cc2a5ec/rollup/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js:224:23)
    at Object.enter (/tmp/5cc2a5ec/rollup/node_modules/rollup-plugin-commonjs/dist/rollup-plugin-commonjs.cjs.js:447:4)
    at visit (/tmp/5cc2a5ec/rollup/node_modules/estree-walker/dist/estree-walker.umd.js:31:9)
    at visit (/tmp/5cc2a5ec/rollup/node_modules/estree-walker/dist/estree-walker.umd.js:53:4)
    at visit (/tmp/5cc2a5ec/rollup/node_modules/estree-walker/dist/estree-walker.umd.js:48:5)
    at visit (/tmp/5cc2a5ec/rollup/node_modules/estree-walker/dist/estree-walker.umd.js:53:4)
    at visit (/tmp/5cc2a5ec/rollup/node_modules/estree-walker/dist/estree-walker.u

without much more context than that.

The change in this PR would allow to know exactly what extractor is causing the above bug.