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 >=3.0.1 fails to resolve projects in monorepo #9202
Comments
|
Likely a regression from #9140. We're bundling the Vite config and all the related files, but because the relative imports point to a file from a package that could have it's own The original issue looks like a workaround for #5370, which doesn't work in the first place. Given this had worked in Vite 3.0.0, maybe it's worth finding a reasonable fix at the meantime, but the better solution overall is to compile the package as JS first. |
- temp workaround for vitejs/vite#9202
|
@bluwy thanks for your reply, I see that now! It doesn't make much sense for me to build it in this particular case as it's mostly various shared code being pulled in to For now, I ended up extracting fragments for vite build out of package with |
|
I've been thinking about this and it's quite tricky in general to support this. It's either:
And both aren't really good choices. The logic for bundling config files is also quite complex now since we had recent issues after Vite 3, and I'm hoping to not touch it anymore. We might have to intentionally break this in 3.0.1 (even though I hate to break semver), but given that it's a workaround before, and it's only 1 patch away. Maybe that's still acceptable. |
|
Same thing happens with
What if you don't have a compilation step? I'm using a shared package for defining config like so: https://stackblitz.com/edit/vitejs-vite-esn1xa?file=app%2Fvite.config.ts It worked with |


Describe the bug
Vite 3.0.1 and higher does not seem to resolve projects within the monorepo.
E.g. we got structure:
Since
[email protected]., I'm getting the error below:This was working fine up till [email protected] and breaks in [email protected] and up.
Vite now fails on relative import in
vite.config.tsIs there a more proper way to do this in vite?
Reproduction
https://stackblitz.com/edit/vitejs-vite-wg28sd?file=apps/app/vite.config.ts
cd apps/app npm install npm run buildSystem Info
System: OS: Windows 10 10.0.22000 CPU: (4) x64 Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz Memory: 3.85 GB / 15.86 GB Binaries: Node: 16.13.0 - C:\Program Files\nodejs\node.EXE npm: 8.1.0 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 103.0.5060.114 Edge: Spartan (44.22000.120.0), Chromium (102.0.1245.44) Internet Explorer: 11.0.22000.120 [email protected]Used Package Manager
pnpm (own project) / npm (stackblitz)
Logs
Validations
The text was updated successfully, but these errors were encountered: