Skip to content

Commit

Permalink
fix: hmr on Windows, close #13
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed May 6, 2021
1 parent 0e67b11 commit 52b140e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/slidev/node/plugins/loaders.ts
@@ -1,6 +1,6 @@
import { basename } from 'path'
import { ModuleNode, Update, ViteDevServer, Plugin } from 'vite'
import { isTruthy, notNullish, objectMap } from '@antfu/utils'
import { isTruthy, notNullish, objectMap, slash } from '@antfu/utils'
import type { Connect } from 'vite'
import fg from 'fast-glob'
import Markdown from 'markdown-it'
Expand Down Expand Up @@ -65,6 +65,8 @@ export function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRo
const slidePrefix = '/@slidev/slides/'
const hmrNextModuleIds: string[] = []

const entryId = slash(entry)

return [
{
name: 'slidev:loader',
Expand Down Expand Up @@ -112,7 +114,7 @@ export function createSlidesLoader({ data, entry, clientRoot, themeRoots, userRo
},

async handleHotUpdate(ctx) {
if (ctx.file !== entry)
if (ctx.file !== entryId)
return

const newData = await parser.load(entry)
Expand Down

0 comments on commit 52b140e

Please sign in to comment.