From 2f22fbf8c254d09b599fbe6ef01c48337ab892a4 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Fri, 11 Jan 2019 22:54:18 +0100 Subject: [PATCH] Replace comment with import() for webpack dynamic entries compat --- packages/next/client/next-dev.js | 2 +- packages/next/taskfile-typescript.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/next/client/next-dev.js b/packages/next/client/next-dev.js index 5aa14972a7a10..a90f41a40e0f1 100644 --- a/packages/next/client/next-dev.js +++ b/packages/next/client/next-dev.js @@ -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__: { diff --git a/packages/next/taskfile-typescript.js b/packages/next/taskfile-typescript.js index 93dd83f7bca44..39482e2e5ab0b 100644 --- a/packages/next/taskfile-typescript.js +++ b/packages/next/taskfile-typescript.js @@ -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')