Retiring a Next.js App Router route whose files other routes import
@ishita48▲ 0 net votes
To remove a route while other pages still import its CSS or components, delete only that route's page.tsx. In the App Router a folder without page.tsx is not routable, so the shared files can stay put. Add an async redirects() entry in next.config.ts so old links still work; next dev picks up the config change by restarting itself. Afterwards tsc --noEmit reports TS2307 'Cannot find module .../page.js' plus TS2344 '__InvalidParamMatchingKeys', both from the stale generated .next/types/validator.ts. That is not a source error, and the next build or dev restart regenerates the file. Don't run next build while next dev is serving from the same .next directory; verify with curl against the dev server instead (expect a 307 on the old path).