Skip to content

Commit

Permalink
Fixing test cases for serverless mode
Browse files Browse the repository at this point in the history
  • Loading branch information
janicklas-ralph committed Jul 10, 2019
1 parent 0a4ea07 commit aafa8d7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
13 changes: 13 additions & 0 deletions packages/next/build/babel/plugins/next-page-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,19 @@ export default function nextPageConfig({
t.returnStatement(t.stringLiteral(inlineGipIdentifier)),
])
},
// handles class { static async getInitialProps() {} }
ClassMethod(path, state: ConfigState) {
if (!state.setupInlining) return
if (
(path.node.key && (path.node.key as BabelTypes.Identifier).name) !==
'getInitialProps'
)
return

path.node.body = t.blockStatement([
t.returnStatement(t.stringLiteral(inlineGipIdentifier)),
])
},
},
}
}
3 changes: 2 additions & 1 deletion packages/next/export/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export default async function (dir, options, configuration) {
dev: false,
staticMarkup: false,
hotReloader: null,
canonicalBase: (nextConfig.amp && nextConfig.amp.canonicalBase) || ''
canonicalBase: (nextConfig.amp && nextConfig.amp.canonicalBase) || '',
isModern: nextConfig.modern
}

const { serverRuntimeConfig, publicRuntimeConfig } = nextConfig
Expand Down
3 changes: 2 additions & 1 deletion packages/next/export/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ process.on(
'static',
buildId,
'pages',
(path === '/' ? 'index' : path) + '.js'
(path === '/' ? 'index' : path) +
`${renderOpts.isModern ? '.es6' : ''}.js`
)

const bundleContent = await readFileP(bundlePath, 'utf8')
Expand Down

0 comments on commit aafa8d7

Please sign in to comment.