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

esm+cjs=failed #324

Closed yurayko closed 6 years ago

yurayko commented 6 years ago

I try to make a bundle from vue and N3-components (vue framework). If I directly select a common js versions for both of them, then all OK. But if select 'vue/dist/vue.esm.js' then rollup crashed with stack trace

rollup -c
main.js → build.js...
[!] TypeError: Cannot read property 'forEach' of null
TypeError: Cannot read property 'forEach' of null
    at Module.getReexports (/home/yuray/prj/r/node_modules/rollup/dist/rollup.js:13018:31)
    at new NamespaceVariable (/home/yuray/prj/r/node_modules/rollup/dist/rollup.js:12409:79)
    at Module.getOrCreateNamespace (/home/yuray/prj/r/node_modules/rollup/dist/rollup.js:13046:42)
    at Module.traceExport (/home/yuray/prj/r/node_modules/rollup/dist/rollup.js:13117:29)
    at /home/yuray/prj/r/node_modules/rollup/dist/rollup.js:21034:40
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:746:11)
    at startup (internal/bootstrap/node.js:238:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:572:3)

Here test repository Or this a rollup Issue ?

lukastaegert commented 6 years ago

Hi @yurayko, from a first look you should definitely use rollup-plugin-node-resolve (which resolved the issues for me). However there still seems to be an issue with rollup itself i.e. you should at least be getting a better error message so please leave this issue open until we got to the bottom of this.

lukastaegert commented 6 years ago

Closing it in favour of rollup/rollup#2317

guybedford commented 6 years ago

I've improved the error output for this case in rollup/rollup#2334.

Note that changing to 'vue': path.resolve('node_modules/vue/dist/vue.esm.js') fixes this too.