Skip to content

Commit

Permalink
Use expression that won't be eliminated by babel
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Jan 9, 2020
1 parent 5e9df56 commit 91be8a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/next/client/next-dev.js
@@ -1,3 +1,4 @@
/* globals __REPLACE_NOOP_IMPORT__ */
import initNext, * as next from './'
import EventSourcePolyfill from './dev/event-source-polyfill'
import initOnDemandEntries from './dev/on-demand-entries-client'
Expand All @@ -10,7 +11,8 @@ import { displayContent } from './dev/fouc'
// 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
// REPLACE_NOOP_IMPORT
// eslint-disable-next-line no-unused-expressions
__REPLACE_NOOP_IMPORT__

// Support EventSource on Internet Explorer 11
if (!window.EventSource) {
Expand Down
3 changes: 2 additions & 1 deletion packages/next/taskfile-babel.js
Expand Up @@ -10,6 +10,7 @@ module.exports = function(task) {
const options = {
...babelOpts,
compact: true,
comments: false,
babelrc: false,
configFile: false,
filename: file.base,
Expand All @@ -30,7 +31,7 @@ module.exports = function(task) {
// Workaround for noop.js loading
if (file.base === 'next-dev.js') {
output.code = output.code.replace(
'// REPLACE_NOOP_IMPORT',
'__REPLACE_NOOP_IMPORT__',
`import('./dev/noop');`
)
}
Expand Down

0 comments on commit 91be8a2

Please sign in to comment.