diff --git a/packages/next/build/webpack/plugins/terser-webpack-plugin/src/index.js b/packages/next/build/webpack/plugins/terser-webpack-plugin/src/index.js index f7d3238810917..e6e2368ad4dc2 100644 --- a/packages/next/build/webpack/plugins/terser-webpack-plugin/src/index.js +++ b/packages/next/build/webpack/plugins/terser-webpack-plugin/src/index.js @@ -180,21 +180,6 @@ export class TerserPlugin { inputSourceMap = null } - // if we are using babel cache we can't rely on the page-config - // plugin to update this value so check for it manually - if (file.match(/pages(\\|\/)/) && input.indexOf(prerenderId) > -1) { - sprStatus.used = true - } - - // force dead-code elimination for SPR related code if not used - const { compress } = this.options.terserOptions - if (compress) { - if (!compress.global_defs) { - compress.global_defs = {} - } - compress.global_defs['self.__HAS_SPR'] = !!sprStatus.used - } - const task = { file, input, diff --git a/packages/next/next-server/lib/router/router.ts b/packages/next/next-server/lib/router/router.ts index 1186fa10f971a..d0012b7123477 100644 --- a/packages/next/next-server/lib/router/router.ts +++ b/packages/next/next-server/lib/router/router.ts @@ -625,11 +625,7 @@ export default class Router implements BaseRouter { const { Component: App } = this.components['/_app'] let props - if ( - // @ts-ignore workaround for dead-code elimination - (self.__HAS_SPR || process.env.NODE_ENV !== 'production') && - (Component as any).__NEXT_SPR - ) { + if ((Component as any).__NEXT_SPR) { let status: any // pathname should have leading slash let { pathname } = parse(ctx.asPath || ctx.pathname)