-
-
Notifications
You must be signed in to change notification settings - Fork 433
Can't use project references without building depended project first #2296
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
Comments
I ran into the same thing a while back and also have not been able to fix it yet, see johnsoncodehk/volar-starter#7 |
Can you try enable noProjectReferences? |
Yes, awesome, that works for me! Should that maybe also be added to the volar-starter repo? See johnsoncodehk/volar-starter#7 |
noProjectReferences doesn't work for me. If I enable noProjectReferences, path aliases don't work in the dependency. |
If you can provide minimal reproduction, I will be able to narrow down the problem. @everhardt volar-starter is not a template for production, it is better to work with create-vue instead. |
I created a bare-bones pnpm monorepo based on A description of the setup is in the README along with some steps to follow to reproduce the various states and error messages. Hopefully that helps. |
Should be resolved with: volarjs/volar.js#24 |
We want to import API types from the
api
project into theapp
project in a monorepos without having to build the.d.ts
files. We use project references so that path mappings in theapi
project can be resolved when imported into theapp
project. Without using project references (inapp
) the types are imported asany
.When using Volar in takeover mode, we get:
Output file '/fleetseer/packages/api/lib/index.d.ts' has not been built from source file '/fleetseer/packages/api/src/index.ts'.
in ourapp
project, when importing@fleetseer/api
.However, this use case appears to be supported by the built-in VS Code TypeScript support. If we turn on TypeScript and JavaScript Language Features in VS Code, the types are correctly resolved by the built-in thing for
*.ts
files (but no change for*.vue
files, as expected).This may be related / a duplicate of #1815
Activating the workspace setting "Volar > Vueserver: No Project References" makes the "Output file has not been built" error go away, however the path mappings in
api
don't resolve correctly.api
(e.g.../../../../my-api-thing.ts
in some cases) which is quite painfulNotes:
@fleetseer/api
is a added as a pnpm workspace dependency (i.e. inpackage.json
:"@fleetseer/api": "workspace:*"
) to theapp
project.api
project is acomposite: true
project referred to by theapp
project*.ts
and*.vue
files in theapp
projectapi
we have a path mapping intsconfig.json
to map"~/*": ["./*"]
with"baseUrl": "./src"
Also both vite (using
vite-tsconfig-paths
) and esbuild (using@esbuild-plugins/tsconfig-paths
) seem to be able to resolve the~/*
alias correctly on build, with the help of the plugins - perhaps there's a similar plugin for Volar?In the end, I think we either:
A. Resolve the reason why the project references don't resolve the same way as the built-in TS services; or
B. Find a way to get the path mapping (e.g.
~/*
) in depended projects (i.e.api
in our case) to work without using project references, as a workaround (perhaps using something like a tsconfig-paths plugin?)Versions
The text was updated successfully, but these errors were encountered: