Custom vite middleware is not executed for CSS files
- 主要言語
- TypeScript
- スター
- 27k
- フォーク
- 11.8k
- 平均マージ
- 14時間 23分
- マージ済み PR(30日)
- 162
説明
### Command
serve
### Description
We are in the process of migrating from using webpack to esbuild/vite.
For development purposes, we need a way to dynamically switch from one theme to another. At this point, we have achieved it by proxying CSS or image files depending on the host name.
After switching to Vite, it turned out that it could work the same, apart from the fact that for CSS resources, our middleware is never executed.
I found a piece of code that seems to be the root cause. The `AngularMemoryPlugin` handles CSS files in a specific way and never executes `next()`, which terminates the middleware chain.
https://github.com/angular/angular-cli/blob/3d7b5f78bdab834cb50c441296c9bf31f7a5e764/packages/angular_devkit/build_angular/src/tools/vite/angular-memory-plugin.ts#L163-L178
### Describe the solution you'd like
Ideally middleware chain should not be terminated in `AngularMemoryPlugin` for stylesheets (ie. `next()` should be called)
### Describe alternatives you've considered
In the worst case scenario, we will find another solution for our use case. However, since the issue only pertains to CSS files, it would be really helpful if the middleware is executed for these files as well.
コントリビューションガイド
調査の方向性
packages/angular_devkit/build_angular/src/tools/vite/angular-memory-plugin.ts の 163–178 行付近にある CSS 処理から開始し、スタイルシート用の Vite middleware chain がどのように完了されるかを追跡します。この変更によって CSS の配信が維持され、CSS リソースに対してカスタム middleware を実行できることを確認してから、serve コマンドの動作を検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript, vite
- 領域
- build-system, cli
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 42/100