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

specifying dependency's commonjs files #292

Closed zwhitchcox closed 6 years ago

zwhitchcox commented 6 years ago

So, it seems like when I import a file that's commonjs, it has some files that have to be specified as commonjs too. Do I just have to keep adding these files to include? Or is there a better way to do this? I really don't want to have to specify 100 different files every time I import a dependency. Is this the intended behavior?

adrianheine commented 6 years ago

Sorry, I don't really understand what you mean. Could you give a quick example?

zwhitchcox commented 6 years ago

Ok, so, maybe I'm doing something wrong here, but I try to import mobx-router for example. It says it's missing an export. Okay, add 'mobx-router/**' to commonjs. Now, director is missing an export, ok, add that. Now, core-js, query-string, strict-uri-encode, decode-uri-component, etc. just to import one package.

I know they should have bundled their code before releasing it, but a lot of people don't do that. Is there a solution here? I can only see that I have to send a PR to them, but I really don't want to do that for any package I might want to import. Especially, since I'm just gonna have to do it again, in every other project.

I have to fix add their dependencies, their dependencies' dependencies and so on.

zwhitchcox commented 6 years ago

Ok, actually, just doing include: ['node_modules/**'] fixed my problem. Not sure if this is a bad idea for some reason, but it works.

adrianheine commented 6 years ago

No, that's exactly what you're supposed to do :)

zwhitchcox commented 6 years ago

Ah. That makes sense.