You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, this behavior used to work in the previous version
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 an ng 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!
The development server has a prebundle option which should allow for the customization needed to handle this use case.
An example configuration would be as follows (note the prebundle option usage):
The prebundle option can also be set to false to disable all Vite-based dependency prebundling/optimization.
If this does not solve the issue, please let us know and we can investigate further.
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: