-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Does vite-tsconfig-paths support mono repo? #71
Comments
There isn't automatic support for monorepos per sé, but I would like to support Yarn workspaces and PNPM workspaces in the future. It depends on what you set If that doesn't work for you, you can try the |
for now: /packages
+ cli
+ common in
"baseUrl": "./src",
"paths": {
"@/test-utils": ["./test-utils/index.js"],
"@/test-utils/": ["./test-utils/"],
"@armit/common": ["../../common/src/index.js"]
},
import { join } from 'path';
import { getDirname, getPackageData } from '@armit/common';
import { runCliMock } from '@/test-utils/cli-run-mock.js'; i have setup import tsConfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [tsConfigPaths({})],
resolve: {
// https://github.com/aleclarson/vite-tsconfig-paths/issues/54
alias: [
// handle `@/*`
{ find: /^(@\/.*)\.js$/, replacement: '$1.ts' },
],
},
We can not typescript source loader from i use yarn 3+ workspace. |
Best practice is to use |
yarn workspace support "dependencies": {
"@armit/common": "workspace:^", i think alias paths defined usng |
Tracking this in #73 |
If I understand you correctly, you want to use |
I'm by no means an expert on this, but Nx recommends using |
Hmm, that makes no sense to me, but you can still use this plugin if that's what you're doing. Just set the If that doesn't work, you can try setting the |
|
It's actually a very common method in NX.dev monorepos (along with using references as much as possible) The benefit of doing this is immense:
When you have typescript monorepo of more than 200 packages, and you don't follow the above, install times can creep up above 10minutes, people stop using intellisense because it doesn't respond fast enough. This approach can be used even if you're not using NX.dev, but then you'd loose the ability to draw a map of the dep graph of your monorepo and thus accurately trigger changes based on what is affected. edit:
|
Please see #77 and give feedback on how it works with NX |
This comment was marked as outdated.
This comment was marked as outdated.
v4.0.0-alpha.6 is now out. Everyone give it a try in your Nx repo please :) |
YES! It works!!! Only change need to be made on the Nx side is to just specify the So:
Thank you so much @aleclarson ! |
Does vite-tsconfig-paths support mono repo? is there some document here?
The text was updated successfully, but these errors were encountered: