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

Vite is unable to resolve the specified import path #511

Open
shivam-sharma7 opened this issue Jan 10, 2025 · 5 comments · May be fixed by #534
Open

Vite is unable to resolve the specified import path #511

shivam-sharma7 opened this issue Jan 10, 2025 · 5 comments · May be fixed by #534
Labels
bug Something isn't working pr welcome

Comments

@shivam-sharma7
Copy link
Contributor

I have created an example project and i try to run dev server then i got the following error

image

@dan-lee @ntotten @AdrianMachado

Copy link

linear bot commented Jan 10, 2025

@dan-lee
Copy link
Contributor

dan-lee commented Jan 10, 2025

Oh, seems to be Windows related. can you try to replace the line 139 in packages/zudoku/src/vite/plugin-api.ts:

([version, path]) =>
`"${version}": () => import("${path}")`,
)

With this?

`"${version}": () => import("${path?.replace("\\", "/")}")`,

Vite should be able to use POSIX style imports.

Either that or replace it with a double backslash. I think the problem is that this code is generated and used as-is, and the backslashes just escape the following char instead of being taken literally.

@dan-lee dan-lee added bug Something isn't working pr welcome labels Jan 10, 2025
@shivam-sharma7
Copy link
Contributor Author

@dan-lee Nice, but I'm not developing with locally, I got issue when I created a fresh zudoku app.

Steps:

pnpm create zudoku-app@latest`

then

pnpm run dev

OS: Windows 11

Also, how you guys make changes and test it locally for zudoku?

@dan-lee
Copy link
Contributor

dan-lee commented Jan 13, 2025

Huh ok that's not good. Thanks for the report. I usually just run nx run with-config:dev (or some other project from the examples folder)

@shivam-sharma7
Copy link
Contributor Author

`"${version}": () => import("${path?.replace("\\", "/")}")`,

@dan-lee I think this should be

 `"${version}": () => import("${filePath?.replace(/\\/g, "/")}")`,

and it's fixed the problem, Thanks for the suggetion opening a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pr welcome
Development

Successfully merging a pull request may close this issue.

2 participants