kiliman / remix-flat-routes

Remix package to define routes using the flat-routes convention
MIT License
743 stars 26 forks source link

ignoredFilePatterns error when launching #89

Open pburrows opened 12 months ago

pburrows commented 12 months ago

Trying to get remix-flat-routes working and am getting the error:

TypeError: ignoredFilePatterns.map is not a function
    at flatRoutes (C:\dev\btc\bigpicture\src\bp-app-remix\node_modules\@remix-run\dev\dist\config\flat-routes.js:71:46)

My remix.config.js looks like this:

import {flatRoutes} from "@remix-run/dev/dist/config/flat-routes.js";

/** @type {import('@remix-run/dev').AppConfig} */
export default {
  ignoredRouteFiles: ["**/.*"],
  serverModuleFormat: "esm",
  routes: async defineRoutes => {
    const routes = flatRoutes('routes', defineRoutes)
    console.log(routes)
    return routes

  }
  // appDirectory: "app",
  // assetsBuildDirectory: "public/build",
  // publicPath: "/build/",
  // serverBuildPath: "build/index.js",
};

and I have renamed my routes to follow the folder conventions (so I have folders paths like this:

routes/auth/signup/_signup.tsx and routes/projects/$project/_project.tsx

I searched the archives here and I don't see anyone else with this ignoredFilePatterns error, so I'm not sure what I'm doing wrong.

Thanks!

kiliman commented 12 months ago

Hmm.. I haven't seen that issue before.

First of all, it looks like your import is wrong.

import { flatRoutes } from 'remix-flat-routes'

Also, your ignoredRouteFiles setting is incorrect. That setting applies to the Remix default convention. You need to specify that all files should be ignored.

ignoredRouteFiles: ["**/*"] // ignore all files (remove the .)