Skip to content

Commit 759aec0

Browse files
committed
chore: use hotUpdate as handleHotUpdate will be removed
1 parent fd277a2 commit 759aec0

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

packages/iles/src/node/plugin/plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ export default function IslandsPlugins (appConfig: AppConfig): PluginOption[] {
116116
if (id === APP_COMPONENT_PATH && !isBuild && appConfig.debug)
117117
return code.replace('const DebugPanel = () => null', () => `import DebugPanel from '${DEBUG_COMPONENT_PATH}'`)
118118
},
119-
handleHotUpdate ({ file, server }) {
120-
if (file === appPath) return [server.moduleGraph.getModuleById(USER_APP_REQUEST_PATH)!]
121-
if (file === sitePath) return [server.moduleGraph.getModuleById(USER_SITE_REQUEST_PATH)!]
119+
hotUpdate ({ file }) {
120+
if (file === appPath) return [this.environment.moduleGraph.getModuleById(USER_APP_REQUEST_PATH)!]
121+
if (file === sitePath) return [this.environment.moduleGraph.getModuleById(USER_SITE_REQUEST_PATH)!]
122122
},
123123
configureServer (devServer) {
124124
server = devServer

packages/pages/src/hmr.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ViteDevServer, Plugin } from 'vite'
22
import { debug, slash } from './utils'
33
import { Awaitable, MODULE_ID, ResolvedOptions, PagesApi } from './types'
44

5-
export function handleHMR (api: PagesApi, options: ResolvedOptions, clearRoutes: () => void): Plugin['handleHotUpdate'] {
5+
export function handleHMR (api: PagesApi, options: ResolvedOptions, clearRoutes: () => void): Plugin['hotUpdate'] {
66
const server = options.server!
77

88
onPage('add', async (path) => {
@@ -17,8 +17,8 @@ export function handleHMR (api: PagesApi, options: ResolvedOptions, clearRoutes:
1717
return true
1818
})
1919

20-
return async (ctx) => {
21-
const path = slash(ctx.file)
20+
return async function ({ file }) {
21+
const path = slash(file)
2222
if (api.isPage(path)) {
2323
const { changed, needsReload } = await api.updatePage(path)
2424
if (changed) debug.hmr('change', path)

packages/pages/src/pages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default function IlesPages (): any {
5858
},
5959
async configureServer (server) {
6060
options.server = server
61-
plugin.handleHotUpdate = handleHMR(api, options, () => { generatedRoutes = undefined })
61+
plugin.hotUpdate = handleHMR(api, options, () => { generatedRoutes = undefined })
6262
},
6363
async buildStart () {
6464
await api.addAllPages()

0 commit comments

Comments
 (0)