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 dev server with npm workspaces not reloading on project reference update #27552
Comments
The development server has a
The |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Command
serve
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I have a monorepo setup using npm workspaces, with
/app
containing the Angular application and/common
containing some common classes, interfaces etc.In the Angular app, in the
tsconfig
I have common set up as a project reference, and this is then made accessible within my angular code by a typical module reference (@myorg/common
).When serving my app, I have typescript set up to watch any changes in the
/common
folder and rebuild, and before switching to the new Vite-based dev server this all worked fine: when doing anng serve
, then modifying a class in common, the app would be reloaded with the latest code.However, with the new server, because Vite caches node modules in
.angular/cache/v17.2.0/vite/deps
, and only refreshes it on package-lock changes, its caching my symlinked common module, and then ignoring any changes I make. Not only does this mean is not live reloading, but on subsequent runs, unless I modify the package lock or remove the cache, it will use a stale version of my common module.In a pure Vite scenario, this would be resolved by adding a
vite.config.ts
file like so:I've read several threads where modifying the Vite config doesn't seem to be possible or on the roadmap for the dev server, so I'm not sure how else I'm supposed to resolve this without disabling the cache entirely through
angular.json
, which removes a lot of the performance benefits. Appreciate any help!Minimal Reproduction
package.json
mkdir app && mkdir common
common
with apackage.json
and a basic classcd app && ng new
/common
, runtsc -w
in one shell and keep running/app
, runng serve
common
. tsc will rebuild but angular dev server will not reloadException or Error
No response
Your Environment
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: