Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Dec 21, 2022
1 parent e1e6880 commit 302c120
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions packages/next/build/webpack/plugins/middleware-plugin.ts
Expand Up @@ -486,32 +486,6 @@ function getCodeAnalyzer(params: {
}
}

/**
* A handler for calls to `new Response()` so we can fail if user is setting the response's body.
*/
const handleNewResponseExpression = (node: any) => {
const firstParameter = node?.arguments?.[0]
if (
isInMiddlewareFile(parser) &&
firstParameter &&
!isNullLiteral(firstParameter) &&
!isUndefinedIdentifier(firstParameter)
) {
const error = buildWebpackError({
message: `Middleware is returning a response body (line: ${node.loc.start.line}), which is not supported.
Learn more: https://nextjs.org/docs/messages/returning-response-body-in-middleware`,
compilation,
parser,
...node,
})
if (dev) {
compilation.warnings.push(error)
} else {
compilation.errors.push(error)
}
}
}

/**
* Handler to store original source location of static and dynamic imports into module's buildInfo.
*/
Expand Down

0 comments on commit 302c120

Please sign in to comment.