Skip to content

Commit 6970d17

Browse files
authored
feat: add removeServerReloadModule future deprecation (#20436)
1 parent 259f45d commit 6970d17

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

docs/changes/per-environment-apis.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ The `Environment` instance was first introduced at `v6.0`. The deprecation of `s
1414
```ts
1515
future: {
1616
removeServerModuleGraph: 'warn',
17+
removeServerReloadModule: 'warn',
1718
removeServerPluginContainer: 'warn',
1819
removeServerHot: 'warn',
1920
removeServerTransformRequest: 'warn',
@@ -32,6 +33,7 @@ In Vite v6, it is now possible to create any number of custom environments (`cli
3233
## Migration Guide
3334

3435
- `server.moduleGraph` -> [`environment.moduleGraph`](/guide/api-environment-instances#separate-module-graphs)
36+
- `server.reloadModule(module)` -> `environment.reloadModule(module)`
3537
- `server.pluginContainer` -> `environment.pluginContainer`
3638
- `server.transformRequest(url, ssr)` -> `environment.transformRequest(url)`
3739
- `server.warmupRequest(url, ssr)` -> `environment.warmupRequest(url)`

packages/vite/src/node/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ export interface FutureOptions {
483483
removePluginHookSsrArgument?: 'warn'
484484

485485
removeServerModuleGraph?: 'warn'
486+
removeServerReloadModule?: 'warn'
486487
removeServerPluginContainer?: 'warn'
487488
removeServerHot?: 'warn'
488489
removeServerTransformRequest?: 'warn'

packages/vite/src/node/deprecations.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const deprecationCode = {
88
removePluginHookHandleHotUpdate: 'changes/hotupdate-hook',
99

1010
removeServerModuleGraph: 'changes/per-environment-apis',
11+
removeServerReloadModule: 'changes/per-environment-apis',
1112
removeServerPluginContainer: 'changes/per-environment-apis',
1213
removeServerHot: 'changes/per-environment-apis',
1314
removeServerTransformRequest: 'changes/per-environment-apis',
@@ -24,6 +25,8 @@ const deprecationMessages = {
2425

2526
removeServerModuleGraph:
2627
'The `server.moduleGraph` is replaced with `this.environment.moduleGraph`.',
28+
removeServerReloadModule:
29+
'The `server.reloadModule` is replaced with `environment.reloadModule`.',
2730
removeServerPluginContainer:
2831
'The `server.pluginContainer` is replaced with `this.environment.pluginContainer`.',
2932
removeServerHot: 'The `server.hot` is replaced with `this.environment.hot`.',

packages/vite/src/node/server/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ export async function _createServer(
641641
return ssrRewriteStacktrace(stack, server.environments.ssr.moduleGraph)
642642
},
643643
async reloadModule(module) {
644+
warnFutureDeprecation(config, 'removeServerReloadModule')
644645
if (serverConfig.hmr !== false && module.file) {
645646
// TODO: Should we also update the node moduleGraph for backward compatibility?
646647
const environmentModule = (module._clientModule ?? module._ssrModule)!

0 commit comments

Comments
 (0)