-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
resolveId
expanding mapped network drives in file names
#525
Comments
thank you for this very detailed report. We are in the process of phasing out support for resolving via "svelte" field, the PR you linked is the first step to that but it'll take months at best for it to be completed. In the meantime vite-plugin-svelte itself can't do much to remedy this situation, maybe vitefu could be improved to return the expected path in this situation, but i recommend not using network drives for development in general. This can cause problems with file change detection, increases the load on your system and generally introduces another point of failure in an already pretty complex system. |
I appreciate the response — I wish not using network drives was an option, but unfortunately it’s a requirement in this case. I can work around this for now by forcing this plugin’s
@bluwy I believe you’re the right person to ping for this; would updating the vitefu path resolver be possible in a shorter time frame? I can try to put together a PR that addresses my use case but I don’t have the context of everywhere that function is used and what effects a change like this would have. |
@stephenlrandall if you can send a PR to vitefu with a fix, that'll be great! it would likely need a fix here. I'm not sure how a leading backslash happens but if the fix can be done for Windows specifically it should be good. |
@bluwy Found something I didn't expect. If you add some print statements to the function you linked: console.log(`pkg: ${pkg}`);
try {
await fs.access(pkg);
// -------------------------------------------------
console.log(`sync: ${fsSync.realpathSync(pkg)}`);
const asyncRes = await fs.realpath(pkg);
console.log(`async: ${asyncRes}`);
// -------------------------------------------------
return await fs.realpath(pkg);
} what you get is:
Vite, in As a fix (and to at least be consistent with Vite proper), would it be possible to simply replace the |
Published vitefu v0.2.4 with the fix. When freshly installing vite-plugin-svelte, it should get the latest version of it now. Closing as fixed. Thanks again for debugging this! |
Describe the bug
There is a discrepancy in resolved path names between
vite:resolve
andvite-plugin-svelte
. The latter's plugin functionresolveId
is usingfindDepPkgJsonPath
from "vitefu", which expands mapped drive names. Looking at a particular dependency:This is returned to Vite as the
resolved
object:By contrast, a non-
package.svelte
dependency (for example,math.js
) is skipped and handled byvite:resolve
instead:This discrepancy leads to the "file not found" error shown in the log section below.
I wasn't sure if this issue would better fit here or in vitefu. But this comment referenced using Vite's
resolve
, which -- if that's the same asvite:resolve
-- would fix this issue.Reproduction URL
not reproducible with a repo alone
Reproduction
On a mapped network drive, set up a new SvelteKit project with at least one dependency that uses the
svelte
package field.Logs
System Info
The text was updated successfully, but these errors were encountered: