Skip to content
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

lint compiler's validateKey function fails on vite dev servers running on windows #1150

Open
1 task done
dbarnespaychex opened this issue Nov 11, 2024 · 5 comments
Open
1 task done

Comments

@dbarnespaychex
Copy link

What version of million are you using?

1.0.12

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Windows

What browser are you using?

Chrome

Describe the Bug

I can't find the source code here, but node_modules\@million\lint\dist\compiler\index.mjs line 2032 has this logic:

if (typeof filename !== "string" || !filename.includes("/"))
    return false;

On Windows, the filename includes \\ characters, so the validateKey function always fails, causing the .vite cache to be cleared and then crashing the Vite dev server because the "cache has been corrupted".

For better compatibility I think you should remove the hard-coded "/" and instead use path.sep:

  if (typeof filename !== "string" || !filename.includes(path.sep))
    return false;

After making that change locally, everything works as expected.

NOTE: The stackblitz link doesn't show the error because it fails before that point on some connection issue.

What's the expected result?

I would expect Vite dev server's cache not to be cleared while running.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/vitejs-vite-5iaffw?file=vite.config.ts

Participation

  • I am willing to submit a pull request for this issue.
Copy link

Thanks for opening this issue! A maintainer will review it soon.

@aidenybai
Copy link
Owner

@dbarnespaychex, repro'd and made a fix, patch will be rolled out in the next release. Thanks for reporting!

@dbarnespaychex
Copy link
Author

You're awesome. Thank you.

@aidenybai
Copy link
Owner

@dbarnespaychex we're in a bit of mid-refactor. I'll try to manually roll out the update sometime today/tomorrow, expect the latest EOW

@xenos1337
Copy link

Hey @aidenybai, I'm having the same issue. When are we getting the fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants