Skip to content

Commit

Permalink
feat: reload page when editing index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 14, 2020
1 parent 0819bcb commit a6a76a7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/node/server/serverPluginHmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,14 @@ export const hmrPlugin: ServerPlugin = ({

watcher.on('change', async (file) => {
const timestamp = Date.now()
if (file.endsWith('.vue')) {
if (resolver.fileToRequest(file) === '/index.html') {
send({
type: 'full-reload',
path: '/index.html',
timestamp
})
console.log(chalk.green(`[vite] `) + `page reloaded.`)
} else if (file.endsWith('.vue')) {
handleVueReload(file, timestamp)
} else if (
file.endsWith('.module.css') ||
Expand Down

0 comments on commit a6a76a7

Please sign in to comment.