We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When installed on Windows and started, the console displays:
📦 Creating ... Error: ENOENT: no such file or directory, mkdir '' at Array.map (<anonymous>) { errno: -4058, code: 'ENOENT', syscall: 'mkdir', path: '' }
This is because the path for utilsPath is generated with getDirectoryFromPath(utilsPath) splitting using forward slashes /
utilsPath
getDirectoryFromPath(utilsPath)
/
next-routes/src/next-plugin.ts
Lines 20 to 21 in bd2a9e0
In the ./next.config.mjs file manually replace all '\' to '/'
./next.config.mjs
import withRoutes from "@triyanox/next-routes"; import path from "path"; import { cwd } from "process"; /** @type {import('next').NextConfig} */ const nextConfig = withRoutes({ }, { utilsPath: path.resolve(cwd(), path.join('lib', 'link$.ts')).replace(/\\/g, "/"), }); export default nextConfig;
Correct routes are not generated as windows file paths cannot be detected.
The routes here are again detecting forward slashes only so no routes are generated:
next-routes/src/utils.ts
Line 89 in bd2a9e0
As a temporary fix:
const name = routePath.split('\\').pop();
.replace(/\\/g, "/")
const cleanPath = (filePath: string, appDir: string = APP_DIR): string => { return filePath .replace(appDir, '') .replace(/\\/g, "/") .replace(/\(.*\)/g, '') .replace(/\/$/, '') .replace(/^\/\//, '/') .replace(/\.[a-z]+$/, '') .replace(/\/page$/, '') .replace(/\/{2,}/g, '/'); };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Issue 1
When installed on Windows and started, the console displays:
This is because the path for
utilsPath
is generated withgetDirectoryFromPath(utilsPath)
splitting using forward slashes/
next-routes/src/next-plugin.ts
Lines 20 to 21 in bd2a9e0
Temporary Fix
In the
./next.config.mjs
file manually replace all '\' to '/'Issue 2
Correct routes are not generated as windows file paths cannot be detected.
The routes here are again detecting forward slashes only so no routes are generated:
next-routes/src/utils.ts
Line 89 in bd2a9e0
As a temporary fix:
const name = routePath.split('\\').pop();
.replace(/\\/g, "/")
after the appDir replaceThe text was updated successfully, but these errors were encountered: