-
-
Notifications
You must be signed in to change notification settings - Fork 613
Description
- Rollup Plugin Name: pluginutils
- Rollup Plugin Version: 3.1.0
Expected Behavior / Situation
Include/exclude patterns work in an intuitive way
Actual Behavior / Situation
Include/exclude patterns don't work in an intuitive way
Modification Proposal
I spent quite some time trying to debug why my include/exclude patterns were not working correctly. Then I found out that here we are doing some magic by prefixing the current working directory to the user provided patterns: https://github.com/rollup/plugins/blob/master/packages/pluginutils/src/createFilter.ts#L15
This creates an invalid pattern when the pattern also includes the working directory. For example I was trying to pass on an explicit list of files to exclude from a plugin. The current working directory got prepended to that, resulting in a pattern that would never match.
For example /Users/me/some/path/to/code.js becomes /Users/me/some/path/Users/me/some/path/to/code.js.
Another problem I ran into is that this way it's impossible to match any files outside of the current working directory. I'm running rollup from a package in a monorepo, the node modules folder is actually two directories upwards.
We could add some magic to detect when to resolve patterns, but I'm wondering why it would be necessary. Could we not just follow the minimatch library logic here?