File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
build/webpack/loaders/next-serverless-loader
test/integration/app-document-import-order/test Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,8 @@ const nextServerlessLoader: webpack.loader.Loader = function () {
138138 }
139139 import { getPageHandler } from 'next/dist/build/webpack/loaders/next-serverless-loader/page-handler'
140140
141+ const documentModule = require("${ absoluteDocumentPath } ")
142+
141143 const appMod = require('${ absoluteAppPath } ')
142144 let App = appMod.default || appMod.then && appMod.then(mod => mod.default);
143145
@@ -163,7 +165,7 @@ const nextServerlessLoader: webpack.loader.Loader = function () {
163165 pageComponent: Component,
164166 pageConfig: config,
165167 appModule: App,
166- documentModule: require(" ${ absoluteDocumentPath } ") ,
168+ documentModule: documentModule ,
167169 errorModule: require("${ absoluteErrorPath } "),
168170 notFoundModule: ${
169171 absolute404Path ? `require("${ absolute404Path } ")` : undefined
Original file line number Diff line number Diff line change @@ -59,8 +59,8 @@ export async function loadComponents(
5959 } as LoadComponentsReturnType
6060 }
6161
62- const AppMod = await requirePage ( '/_app' , distDir , serverless )
6362 const DocumentMod = await requirePage ( '/_document' , distDir , serverless )
63+ const AppMod = await requirePage ( '/_app' , distDir , serverless )
6464 const ComponentMod = await requirePage ( pathname , distDir , serverless )
6565
6666 const [
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ describe('Root components import order', () => {
3838 const html = await res . text ( )
3939 const $ = cheerio . load ( html )
4040
41- const expectSideEffectsOrder = [ '_app ' , '_document ' , 'page' ]
41+ const expectSideEffectsOrder = [ '_document ' , '_app ' , 'page' ]
4242
4343 const sideEffectCalls = $ ( '.side-effect-calls' )
4444
@@ -87,7 +87,7 @@ describe('Root components import order', () => {
8787 afterAll ( ( ) => killApp ( app ) )
8888
8989 it (
90- 'root components should be imported in this order _app > _document > page in order to respect side effects' ,
90+ 'root components should be imported in this order _document > _app > page in order to respect side effects' ,
9191 respectsSideEffects
9292 )
9393
You can’t perform that action at this time.
0 commit comments