Fix serverless dynamic routes (#7505)
* Fix serverDir resolving for autoExporting * Fix dynamic routes in serverless loader
This commit is contained in:
parent
2153789358
commit
93aaacd58d
1 changed files with 2 additions and 2 deletions
|
@ -43,7 +43,7 @@ const nextServerlessLoader: loader.Loader = function() {
|
|||
import {sendHTML} from 'next-server/dist/server/send-html';
|
||||
${
|
||||
page.includes('/$')
|
||||
? `import {getRouteMatch} from 'next-server/dist/lib/router/utils';`
|
||||
? `import {getRouteMatcher, getRouteRegex} from 'next-server/dist/lib/router/utils';`
|
||||
: ''
|
||||
}
|
||||
import buildManifest from '${buildManifest}';
|
||||
|
@ -79,7 +79,7 @@ const nextServerlessLoader: loader.Loader = function() {
|
|||
${page === '/_error' ? `res.statusCode = 404` : ''}
|
||||
${
|
||||
page.includes('/$')
|
||||
? `const params = getRouteMatch("${page}")(parsedUrl.pathname) || {};`
|
||||
? `const params = getRouteMatcher(getRouteRegex("${page}"))(parsedUrl.pathname) || {};`
|
||||
: `const params = {};`
|
||||
}
|
||||
const result = await renderToHTML(req, res, "${page}", Object.assign({}, parsedUrl.query, params), renderOpts)
|
||||
|
|
Loading…
Reference in a new issue