rollup / plugins

🍣 The one-stop shop for official Rollup plugins
MIT License
3.57k stars 567 forks source link

[@rollup/plugin-node-resolve] confusion about what this plugin does #1711

Closed darkship closed 2 months ago

darkship commented 2 months ago

Documentation Is:

Please Explain in Detail...

There is no mention of bundling 3rd party libs into the final bundle like it is in the main plugin readme

Your Proposal for Changes

Replace A Rollup plugin which locates modules using the [Node resolution algorithm](https://nodejs.org/api/modules.html#modules_all_together), for using third party modules in node_modules

by something like A Rollup plugin which locates and bundles modules from node_modules

shellscape commented 2 months ago

thanks for opening an issue. unfortunately I have to disagree with your take there. the main premise of a bundler in the JavaScript ecosystem is to combine local project code with dependencies. now, you can opt out of bundling dependencies and most bundlers allow for this. (in the JavaScript ecosystem a dependency is also known as a third party library.)

The documentation stating that the plug-in uses the node module resolution is equivalent to saying that it targets things in node_modules, but more specific and more correct. The link to the node documentation would explain where it looks for dependencies, or third party modules.

darkship commented 2 months ago

Right, a bundler is for bundling.

But here, I'm only talking about what this plugin does and includes in the bundle.

This is what I can see in the main readme and then not in the plugin readme: image

I removed this plugin from my project as it included all dependencies and peer dependencies in the bundle while another was removing it. It was probably here because it was copied from a random tutorial or project template.