Closed alex-kinokon closed 6 years ago
Can you confirm that this has happened with the change from 9.1.0 to 9.1.1?
In any case, I will re-release 9.1.0 as 9.1.2 now until we get to the bottom of this.
Done
This is still occurring with rollup-plugin-commonjs 9.1.3. See this issue for full description of my config: https://github.com/glixlur/rollup-plugin-ignore/issues/2
I came here by searching for rollup Cannot read property 'forEach' of null
I'm not sure what is causing this in my code, but if I remove the commonjs plugin, the error is different (because it can't process requires otherwise), so it leads me to believe this plugin is the root cause.
I am using the following plugins
plugins: [
typescript(), // rollup-plugin-typescript2
resolve(),
commonjs()
]
Stack trace
TypeError: Cannot read property 'forEach' of null
at Module.getReexports (node_modules/rollup/dist/rollup.js:17195:31)
at new NamespaceVariable (node_modules/rollup/dist/rollup.js:7921:79)
at Module.getOrCreateNamespace (node_modules/rollup/dist/rollup.js:17224:42)
at Module.traceExport (node_modules/rollup/dist/rollup.js:17286:29)
at node_modules/rollup/dist/rollup.js:20813:40
at <anonymous>
@lukastaegert I don’t think the commit has anything to do with this issue. commonjs
needs to skip all modules starting with \0
except \0commonjs-proxy
.
@jeffijoe I agree this has probably nothing to do with the current issue. From the stack trace this very much looks like an issue with rollup itself and should be raised there. The reason removing this plugin changes the error could be because the error originates from a CJS module.
Before raising an issue for rollup itself, make sure you are using the latest rollup version 0.59.4 as well as the latest version of the plugins. It would also be EXTREMELY helpful and significantly shorten the time until it is fixed if you could add a repo exposing the error.
@lukastaegert I've reproduced the bug for you: https://github.com/aleclarson/rollup-bugs/tree/commonjs-issue-315
Hope that helps :)
@aleclarson Thanks! I already opened an issue on rollup for this an linked your repository: https://github.com/rollup/rollup/issues/2317#issuecomment-402264041
@lukastaegert The bug demonstrated by my repro is fixed by PR #327 to this plugin. :)
Ah, I might have mixed up issues here. Thanks a lot! As I am just heading off to my vacation it might be a week until I can review it properly, though.
I've improved the error output for this case in https://github.com/rollup/rollup/pull/2334.
The fix at #327 seems roughly the right direction to me.
[src] [!] Error: 'empty_module' is imported as an external by empty_module?commonjs-proxy, but is already an existing non-external module id.
[src] Error: 'empty_module' is imported as an external by empty_module?commonjs-proxy, but is already an existing non-external module id.
[src] at error (/data/DevelopmentRoot/canaan-creative/door/admin/app/node_modules/rollup/dist/rollup.js:10162:30)
[src] at ModuleLoader.fetchResolvedDependency (/data/DevelopmentRoot/canaan-creative/door/admin/app/node_modules/rollup/dist/rollup.js:17226:24)
[src] at ModuleLoader.<anonymous> (/data/DevelopmentRoot/canaan-creative/door/admin/app/node_modules/rollup/dist/rollup.js:17286:25)
[src] at Generator.next (<anonymous>)
[src] at fulfilled (/data/DevelopmentRoot/canaan-creative/door/admin/app/node_modules/rollup/dist/rollup.js:40:28)
It seems that this plugin will attempt to process virtual modules generated by other plugins, contrary to the convention. rollup-plugin-ignore uses
\0empty-module
as a virtual module for an empty module file, which in turns is transformed by rollup-plugin-commonjs as\0commonjs-proxy:\0empty_module
.