-
-
Notifications
You must be signed in to change notification settings - Fork 592
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
[plugin-dynamic-import-vars] non-normalized paths no longer work #1791
Comments
@benmccann looks like you missed an edge case here. please take a look. |
CC @SuperchupuDev it looks like there's a behavior difference between fast-glob and tinyglobby that has broken things here |
@benmccann if it's a upstream issue reverting the change until we can get the tinyglobby issue resolved is probably the wise play here. |
tinyglobby intentionally doesn't change the format of the glob results depending on the pattern provided for better consistency and also due to the way it works (tinyglobby doesn't transform results except on very specific circumstances). i believe vite had to apply a workaround here to make it work, but in theory using |
What do you mean by "depending on the pattern"? It seems the pattern itself is normalized before generating results, here, from |
that normalizes the pattern to match, not the way the results from the directory crawler are generated. the only case where the patterns can modify the result is if any of the patterns start with the crawler library generates a result that's always the exact same no matter the patterns, and each possible result that's generated is filtered by the (normalized) patterns if you have a directory that has |
So then the issue is with the crawler then. I don't think it's actually an issue, though. Certainly not from its perspective. It might be best to just normalize the paths at runtime in the plugin. |
IIRC vite fixed this by appending |
Just FYI I am very heads down prepping for Svelte Summit this week. If someone is able to look at this issue that would be great. Otherwise I'll take a look next week |
Good to know. We'll give it a day to see if anyone can step in and if not I'll revert. |
@SuperchupuDev // you can imagine this path being constructed by a series of `concats`
import('./${myHost}/./${myProject}/./${myComponent}.js`') turns into |
If we're ok adding path-normalize I can do that work now. |
@bearfriend not opposed to it in the plugin. we'll want a regression test for this car as well. |
@shellscape I believe I have something working that I'm ready to open a PR for, Edit: Got it sorted. I must have had some junk in
|
Making the decision to revert the changes. The only tangible benefit was a reduction of dependencies, but the juice isn't worth the squeeze. |
Expected Behavior
Imports passed non-normalized paths resolve the bundled file
Actual Behavior
Imports passed non-normalized paths produce a
Unknown variable dynamic import
errorAdditional Information
#1780 breaks any code that doesn't build normalized paths because
tinyglobby
always outputs normalized glob paths but the plugin doesn't touch the original code.Given this code:
tinyglobby
produces../*.js
->../myFile.js
->case '../myFile.js'
, which now doesn't match./../myFile.js
.I think the only reasonable options are:
tinyglobby
to make normalization optional (will take time and maybe isn't even feasible/desired)__variableDynamicImportRuntime__
before theswitch
withpath-normalize
The text was updated successfully, but these errors were encountered: