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

Support fallback and other objects under rewrites in next config. #353

Open
jsmittyTrails opened this issue Aug 3, 2022 · 0 comments
Open

Comments

@jsmittyTrails
Copy link

In the next configuration rewrites are not just arrays but also objects in the latest versions. When adding fallbacks in the rewrites and running tf-next build you end up with an error.

Example of a fallback rewrite:

async rewrites() {
    return {
      fallback: [
        {
          source: '/:path*',
          destination: `${host}/:path*`,
        },
        {
          source: '/:locale*/:path*',
          destination: `${host}/:path*`,
          locale: false,
        },
      ],
    }
  },

This ultimately results in an error because the return is not an array but an object:

TypeError: e.map is not a function
    at convertRewrites (/opt/homebrew/lib/node_modules/tf-next/node_modules/@millihq/tf-next-runtime/dist/index.js:1:162099)
    at build (/opt/homebrew/lib/node_modules/tf-next/node_modules/@millihq/tf-next-runtime/dist/index.js:33:145798)
    at async buildCommand (/opt/homebrew/lib/node_modules/tf-next/dist/commands/build/build.js:132:29)
    at async Object.createBuildCommand.withApiService [as handler] (/opt/homebrew/lib/node_modules/tf-next/dist/commands/build/build.js:203:5)
    ```
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

1 participant