Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[turbopack] middleware is ignored in Next.js #2905

Closed
useafterfree opened this issue Dec 2, 2022 · 1 comment
Closed

[turbopack] middleware is ignored in Next.js #2905

useafterfree opened this issue Dec 2, 2022 · 1 comment
Labels
kind: bug Something isn't working

Comments

@useafterfree
Copy link

What version of Turbopack are you using?

alpha

What package manager are you using / does the bug impact?

npm

What operating system are you using?

Mac

Describe the Bug

middleware.ts and middleware.js in the root of the project are not ran

Expected Behavior

Middleware should be executed on api routes.

To Reproduce

create turbopack app

npx create-next-app --example with-turbopack

create a middleware file (middleware.js) with the following contents:

console.log({ middleWare: true})

import { NextResponse } from "next/server";

export default (req) => {
  return NextResponse.next();
};

// Stop Middleware running on static files
export const config = { matcher: '/((?!.*\\.).*)' }

start next

npm run dev

observe turbopack does not load the file

{ middleWare: true } does not exist in the output

observe omitting turbopack loads the file

npx next dev
{ middleWare: true } exists in the output

Reproduction Repo

No response

@useafterfree useafterfree added area: turbopack kind: bug Something isn't working labels Dec 2, 2022
@useafterfree
Copy link
Author

Closing since it duplicates: vercel/next.js#42921

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant