facebook / facebook/docusaurus

Webpack dev server does NOT hot reload (affecting swizzle aliases, prism...)

Đang mở
#10,238 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug domain: dx
Ngôn ngữ chính
TypeScript
Star
66.2k
Fork
10k
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
52

Mô tả

### Description

As far as I know, to this day, it is not possible to update Webpack Dev Server config while the dev server is running (https://github.com/webpack/webpack-cli/issues/15)

Unfortunately, we need this for Docusaurus, otherwise there are many situations requiring users to restart the Docusaurus dev server (`docusaurus start`), notably:
- `docusaurus swizzle` modifies Webpack aliases, affecting module resolution (see my comment https://github.com/facebook/docusaurus/pull/10236#issuecomment-2180404988)
- Adding additional `prism` syntax highlighting language (see https://github.com/facebook/docusaurus/issues/7913)
- Any other Docusaurus config change affecting the Webpack config (in particular plugins using `configureWebpack`)

If no solution is provided by Webpack, we may need to stop/recreate the dev server ourselves in cases we are able to detect. Detecting aliases changes might be the lowest hanging fruit to implement.

### Steps to reproduce

Swizzle any component while the dev server is running: the new swizzled copy is added to your site but if you modify it nothing happens. This is because Webpack is still loading the original files. Webpack should load the new swizzled files

### Your environment

- Docusaurus version used: 3.4

### Self-service

- [X] I'd be willing to fix this bug myself.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.