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

Lint broken with Next.js URL rewrites - TypeError: prevRewrites is not iterable #1036

Closed
1 task done
AugusDogus opened this issue May 21, 2024 · 3 comments
Closed
1 task done

Comments

@AugusDogus
Copy link

What version of million are you using?

1.0.0-rc.0

Are you using an SSR adapter? If so, which one?

N/A

What package manager are you using?

pnpm

What operating system are you using?

Windows

What browser are you using?

Chrome

Describe the Bug

Making use of fallback URL rewrites appears to break million lint.

import MillionLint from "@million/lint";
/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  async rewrites() {
    return {
      fallback: [
        {
          source: "/:path*",
          destination: `https://example.com/:path*`,
        },
      ],
    };
  },
};
export default MillionLint.next()(nextConfig);
$ pnpm dev

TypeError: prevRewrites is not iterable
    at Object.rewrites (file:///C:/Users/augie/dev/playground/million-rewrites-example/node_modules/.pnpm/@million+lint@1.0.0-rc.1/node_modules/@million/lint/dist/compiler/index.mjs:3085:14)
    at async loadRewrites (C:\Users\augie\dev\playground\million-rewrites-example\node_modules\.pnpm\next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1\node_modules\next\dist\lib\load-custom-routes.js:382:23)
    at async Promise.all (index 1)
    at async loadCustomRoutes (C:\Users\augie\dev\playground\million-rewrites-example\node_modules\.pnpm\next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1\node_modules\next\dist\lib\load-custom-routes.js:435:44)
    at async setupFsCheck (C:\Users\augie\dev\playground\million-rewrites-example\node_modules\.pnpm\next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1\node_modules\next\dist\server\lib\router-utils\filesystem.js:245:24)
    at async initialize (C:\Users\augie\dev\playground\million-rewrites-example\node_modules\.pnpm\next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1\node_modules\next\dist\server\lib\router-server.js:61:23)
    at async Server.<anonymous> (C:\Users\augie\dev\playground\million-rewrites-example\node_modules\.pnpm\next@14.2.3_@babel+core@7.24.5_react-dom@18.3.1_react@18.3.1\node_modules\next\dist\server\lib\start-server.js:249:36)

What's the expected result?

The million lint server should start normally.

Ex - rewrites commented out:

import MillionLint from "@million/lint";
/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  // async rewrites() {
  //   return {
  //     fallback: [
  //       {
  //         source: "/:path*",
  //         destination: `https://example.com/:path*`,
  //       },
  //     ],
  //   };
  // },
};
export default MillionLint.next()(nextConfig);
$ pnpm dev

▲ Next.js 14.2.3
  - Local:        http://localhost:3000

 ✓ Starting...

 ⚡ Million Lint v1.0.0-rc.1
 - Local server: http://localhost:42423

 ✓ Ready in 0.31ms
 ✓ Ready in 2.6s

Link to Minimal Reproducible Example

https://stackblitz.com/github/AugusDogus/million-rewrites-example

Participation

  • I am willing to submit a pull request for this issue.
Copy link

Thanks for opening this issue! A maintainer will review it soon.

@aidenybai
Copy link
Owner

Hey @AugusDogus, we just pushed a fix. Can you try upgrading to latest?

npm i @million/lint@latest

@AugusDogus
Copy link
Author

Thanks for the quick turnaround! I can confirm the fix works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants