New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regex in external doesn't exclude local import #3811
Comments
While I understand your pain, the previous behaviour was both inconsistent and contradicted what was written in the documentation. But I think there is still a way to achieve what you want. So what happens is that when you import e.g. So what you need to do is extend your regular expression to also exclude absolute paths. On non-Windows systems, this should be as easy as
while on Windows, you need something more involved. Another variant would be to use a function: import path from 'path';
// ...
external(id) {
return id[0] !== '.' && !path.isAbsolute(id);
} Hope this helps. |
It works like a charm thank you so much ! I'm using the function variant to be compatible with all environments. |
To avoid unresolved dependencies warning on compilation, I use a regex (
/^[^.].+/
) for the external rollup configuration to exclude all the imports which starts with "." (it means all the local import in fact).It worked perfectly before 2.26.8 but a change in 2.26.8 broke the trick.
It seems that now, it's impossible to exclude the local import with a regex if you have a least a regex with
/.+/
or/.*/
.Expected Behavior
Include the import like
"./..."
in the bundle with the regex in the external.Actual Behavior
Treat the import like
"./..."
as external module with the regex in the external.The text was updated successfully, but these errors were encountered: