saltyshiomix / nextron

⚡ Next.js + Electron ⚡
https://npm.im/nextron
MIT License
3.97k stars 229 forks source link

Middleware.ts does not trigger in nextron #490

Open alieldeba opened 3 months ago

alieldeba commented 3 months ago

Hey @saltyshiomix,

I want to make a middleware that redirects user to /home if he goes to / and I have made this middleware file:

import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";

export function middleware(request: NextRequest) {
  return NextResponse.redirect(new URL("/home", request.url));
}

My problem is that it does not redirect user to /home and does not work at all.

this is my project structure:

image

and I want to know if I can run my nextron app with --turbo flag

alieldeba commented 3 months ago

attention please as I do not have time and should make this project as quickly as possible @cellis @jogoodma @ColeTownsend @beinbm thanks.

alieldeba commented 3 months ago

Middleware worked after I have deleted the "output": "export" line in next.config.js file

image

alieldeba commented 3 months ago

The build failed it should be "output": "export" in the build but it works fine in dev mode