mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
fix(server): avoid caching .js
assets in development to fix HMR for safari (#9034)
This commit is contained in:
parent
2c4cc04b49
commit
1474f14fc0
@ -114,6 +114,12 @@ export default class Server {
|
|||||||
if (!this.devMiddleware) {
|
if (!this.devMiddleware) {
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
// Safari over-caches JS (breaking HMR) and the seemingly only way to turn
|
||||||
|
// this off in dev mode is to set Vary: * header
|
||||||
|
// #3828, #9034
|
||||||
|
if (req.url.startsWith(this.publicPath) && req.url.endsWith('.js')) {
|
||||||
|
res.setHeader('Vary', '*')
|
||||||
|
}
|
||||||
this.devMiddleware(req, res, next)
|
this.devMiddleware(req, res, next)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user