aleclarson / vite-tsconfig-paths

Support for TypeScript's path mapping in Vite
MIT License
1.23k stars 44 forks source link

[BUG] "[vite]: Rollup failed to resolve import" with vite-tsconfig-paths plugin #135

Open Giorno-Giovana opened 5 months ago

Giorno-Giovana commented 5 months ago

Source code

https://codesandbox.io/p/devbox/playwright-vite-representation-hxndcz

Problem

[vite]: Rollup failed to resolve import "@/components/Counter" from "/workspaces/workspace/playwright/index.tsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
Error: [vite]: Rollup failed to resolve import "@/components/Counter" from "/workspaces/workspace/playwright/index.tsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

The reason is my vite-tsconfig-paths plugin. My App is working fine and TS imports too. But, for some reason, not in playwright.

Steps to reproduce

Run npm run test-ct


This issue in playwright repo: https://github.com/microsoft/playwright/issues/29196

Giorno-Giovana commented 5 months ago

If I write this code in playwright config, then everything will work. But this does not negate the fact that for some reason playwright does not want to work with vite-tsconfig-paths

alias: {
  '@': resolve(dirname('.'), './src'),
},
JasonLandbridge commented 3 months ago

@Giorno-Giovana Did you manage to solve this? I got the same issue.

k-teplyakov commented 3 months ago

me too

JasonLandbridge commented 3 months ago

@k-teplyakov, In my case it was due to an update of Nuxt. See this issue for more info: https://github.com/nuxt/nuxt/issues/26512

Giorno-Giovana commented 3 months ago

@Giorno-Giovana Did you manage to solve this? I got the same issue.

Hi! Look here https://github.com/microsoft/playwright/issues/29196#issuecomment-1933307880

Razunter commented 2 months ago

I have the same issue with Bun on Windows