facebook / facebook/docusaurus

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

Open
#10,238 0 comments 0 reactions 0 assignees View on GitHub
bug domain: dx
Dominant language
TypeScript
Stars
66.2k
Forks
10k
Avg merge
1d 3h
Merged PRs (30d)
52

Description

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.