1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Make dynamic import support to work with HMR.

This commit is contained in:
Arunoda Susiripala 2017-04-27 12:41:02 -07:00
parent 93da57e1f6
commit 358cfb3a29
2 changed files with 12 additions and 0 deletions

View file

@ -26,6 +26,12 @@ export default class PagesPlugin {
source: () => newContent,
size: () => newContent.length
}
// This is to support, webpack dynamic import support with HMR
compilation.assets[`chunks/${chunk.id}`] = {
source: () => newContent,
size: () => newContent.length
}
})
callback()
})

View file

@ -106,6 +106,12 @@ export default class Server {
await this.serveStatic(req, res, p)
},
// This is to support, webpack dynamic import support with HMR
'/_next/webpack/:id': async (req, res, params) => {
const p = join(this.dir, '.next', 'chunks', params.id)
await this.serveStatic(req, res, p)
},
'/_next/:hash/manifest.js': async (req, res, params) => {
this.handleBuildHash('manifest.js', params.hash, res)
const p = join(this.dir, `${this.dist}/manifest.js`)