Reputation: 3422
next-config.js
/** @type {import('next').NextConfig} */
module.exports = {
i18n: {
locales: ['en', 'ru'],
defaultLocale: 'en',
},
publicRuntimeConfig: {
API_URL: process.env.API_URL,
},
images: {
domains: ['fakestoreapi.com'],
},
trailingSlash: true,
webpack: (config, { isServer }) => {
const newConfig = { ...config };
if (!isServer) {
newConfig.resolve.fallback.fs = false;
}
return newConfig;
},
};
Next sitemap version - "next-sitemap": "^2.1.15",
next-sitemap.js
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: 'https://box.hedgefun.net/',
generateRobotsTxt: true,
};
Above you can see as I try to use next-sitemap
for creating sitemap , I've found solution to add fs
to next-config.js
file, for webpack 5
. But it show me next issue . How can I fix it ?
node -v
v14.16.0
Upvotes: 2
Views: 8976
Reputation: 31
I solved this problem by upgrading my node version to v16.17.0. Also, take a look at this solution. [1]: Module not found: Can't resolve 'fs' in Next.js application
Upvotes: 1
Reputation: 446
I'm facing the same issue in Node v12.22.12.
I have solved issue by updating the Node version to v14.18.0
So please update the Node version to v14.18.0 or more
Upvotes: 4
Reputation: 113
In my case, I was able to solve this problem by simply increasing the node version:
v14.17.0` -> `v16.14.2
Upvotes: 3