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:
parent
93da57e1f6
commit
358cfb3a29
|
@ -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()
|
||||
})
|
||||
|
|
|
@ -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`)
|
||||
|
|
Loading…
Reference in a new issue