Skip to content

Commit

Permalink
Fix bug on command line side of reload where reload.js file wasn't be…
Browse files Browse the repository at this point in the history
… served and index.html auto serving from `/` not having the injected script tag for reload.js file
  • Loading branch information
alallier committed Aug 14, 2024
1 parent 9ead609 commit 99c7b98
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/reload-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ const server = http.createServer(function (req, res) {
const file = path.join(dir, pathname)

// reload script
if (pathname === 'reload/reload.js') {
if (pathname === '/reload/reload.js') {
res.writeHead(200, { 'Content-Type': 'text/javascript' })
return res.end(reloadReturned.reloadClientCode())
}

// static assets
if (ext !== '.html' && ext !== '.htm' && fs.existsSync(file)) {
// static assets, not a .html or .htm or empty extension when auto serving `/` to index.html
if (ext !== '.html' && ext !== '.htm' && ext !== '' && fs.existsSync(file)) {
return serve(req, res, finalhandler(req, res))
}

Expand Down

0 comments on commit 99c7b98

Please sign in to comment.