Commit 358cfb3a authored by Arunoda Susiripala's avatar Arunoda Susiripala

Make dynamic import support to work with HMR.

parent 93da57e1
......@@ -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`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment