mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Replace comment with import() for webpack dynamic entries compat
This commit is contained in:
parent
ad5431b4ae
commit
2f22fbf8c2
|
@ -6,7 +6,7 @@ import initWebpackHMR from './webpack-hot-middleware-client'
|
|||
// https://github.com/zeit/next.js/issues/3775#issuecomment-407438123
|
||||
// The runtimeChunk doesn't have dynamic import handling code when there hasn't been a dynamic import
|
||||
// The runtimeChunk can't hot reload itself currently to correct it when adding pages using on-demand-entries
|
||||
import('./noop')
|
||||
// REPLACE_NOOP_IMPORT
|
||||
|
||||
const {
|
||||
__NEXT_DATA__: {
|
||||
|
|
|
@ -37,7 +37,7 @@ try {
|
|||
}
|
||||
|
||||
// Workaround for noop.js loading
|
||||
if (file.base === 'next-dev.js') result.outputText = result.outputText.replace(/Promise\.resolve\(\)\.then\(\(\) => __importStar\(require\('\.\/noop'\)\)\);/, `import('./noop');`)
|
||||
if (file.base === 'next-dev.js') result.outputText = result.outputText.replace('// REPLACE_NOOP_IMPORT', `import('./noop');`)
|
||||
|
||||
// update file's data
|
||||
file.data = Buffer.from(result.outputText.replace(/process\.env\.NEXT_VERSION/, `"${require('./package.json').version}"`), 'utf8')
|
||||
|
|
Loading…
Reference in a new issue