1
0
Fork 0
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:
Tim Neutkens 2019-01-11 22:54:18 +01:00
parent ad5431b4ae
commit 2f22fbf8c2
2 changed files with 2 additions and 2 deletions

View file

@ -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__: {

View file

@ -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')