Closed mehdimahmoudi closed 1 year ago
@mehdimahmoudi could you share the error you’re encountering?
@tatethurston
I get this linting error: Unable to resolve path to module 'nextjs-routes/config'
also keeping me from building the app.
But I don't think it's just a linting because other requires work well.
Here's my next.config.js
file
// @ts-check
// @TODO: Cannot be imported or built with
const nextRoutes = require('nextjs-routes/config');
const withRoutes = nextRoutes();
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
const { i18n } = require('./next-i18next.config');
// Route typing
const withRoutes = nextRoutes({ outDir: 'src/types/routes', cwd: __dirname });
/**
* @type {import('next').NextConfig}
**/
const baseConfig = withBundleAnalyzer({
reactStrictMode: false,
i18n,
eslint: {
ignoreDuringBuilds: true,
},
});
module.exports = withRoutes(baseConfig);
Note: I'm using pnpm
Thanks
@mehdimahmoudi Do you encounter any typescript errors? Eg running tsc —noEmit?
Also, could you update your ESLint dependencies to make sure they’re not outdated
@tatethurston
Just updated to ESLInt 8.42 (yesterday 8.41
npx tsc --noEmit
still gives:
@mehdimahmoudi I believe this is an issue with your local dependencies and not this library. I'm sorry for the unsatisfying answer.
To debug this on your end, you could start by copying one of the examples -- like the typescript example -- locally and seeing if you still encounter the error (you shouldn't). From there you can compare your dependencies to the example project dependencies to narrow it down.
Hi, First things first, thank you for this great tool! Amazing and accurate work.
I'm facing a dependency resolution issue that's keeping me from building the project without having to comment / disable the nextjs-routes require line.
Important to note that although the module is not resolved and ESLinting showing an error, it still works perfectly and generates routes at the right location as expected.
Any clue?
Thanks!