angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

[Feature][Vite] Add support for external vite.config.js

Open pgfeller opened this issue 9 months ago • 0 comments

Command

serve

Description

Angular introduced vite support - which is a great improvement. If I understand the implementation a fallback mechanism to webpack is used in case a feature is not (yet) supported by vite (like e.g. wasm web assembly).

The official documentation recommends to write custom plugins if the default ones to not provide the features required. To get more control over esbuild plugins and to evaluate the possibility to use existing vite plugins I've contacted the people from the angular-builders project and opened a feature request there: ➡️ [Feature Request] - Support to use/add Vite loader plugins

I've created a POC, but realized that I can not inject vite custom configuration without modifying angular-cli builder - or to re-implement it's functions.

It would be desirable if we could derive a custom builder from the vanilla one to add this feature. The respective configuration is currently not available.

The POC also showed that not all vite plugins will work properly with angular - so I understand that this will not be supported by the angular team. But it would be nice if the possibility exists for projects to derive from the code and provide/support custom plugins.

Describe the solution you'd like

It would be desirable that it is easier to derive from the default build / serve implementations to customize them (in this case custom vite config - similar to webpack). This would allow other projects to leverage the existing implementation without hacks and the support of the added or changed functions would be with the respective project (not the core angular team).

Describe alternatives you've considered

At the moment we fall back to webpack - but we've to consider to drop either the wasm packages and replace them with something else; and even switching the framework to vue was considered by the team.

pgfeller avatar May 23 '24 09:05 pgfeller