#npm run dev not working
32 messages · Page 1 of 1 (latest)
by the error message it looks like there is something wrong in the config file in line 5
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
};
config.plugins.push(
new webpack.ProgressPlugin((percentage, message, ...args) => {
// e.g. Output each progress message directly to the console:
console.info(percentage, message, ...args);
})
);
module.exports = nextConfig;
module.exports = {
pageExtensions: ["mdx", "md", "jsx", "js", "tsx", "ts"],
};
This is my nextconfig file
What could be wrong about this?
where is config coming from?
To my knowledge I left it the way it was when creating the next js app
you can't have two module.exports at the same time too, they are overriding each other
So I should merge them?
Mmh how would I go around that? I never had this error before as my dev environment had always worked with next
because how should i define config?
I searched like 50 links on google but the only thing I read are people saying the node version is not up to date
However I checked and they are so it must be something else
To my knowledge I never touched the config file, with the only exception for the pageExtensions
by the looks of your code, config should be a webpack config
the next config allows you to extend the default webpack config which is probably what this code is doing
here is a reference: https://nextjs.org/docs/api-reference/next.config.js/custom-webpack-config
so to fix the code you would move it inside the webpack property of the first config object you created
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
webpack: (config) => {
config.plugins.push(...) // your code here
}
}```
then for the other issue (the double module.exports), you can move the pageExtensions inside this object as well
Thanks a lot I removed it for now but I am going to try this tomorrow!
tbh I don't think you even need this line (config.plugins), it is adding a progress plugin which will just output a lot of stuff in the terminal
new webpack.ProgressPlugin((percentage, message, ...args) => {
// e.g. Output each progress message directly to the console:
console.info(percentage, message, ...args);
})
}
};```
So I still need the config within it?
you need the config.plugins.push part otherwise that would instancialize the plugin in the void
I mean you don't need this plugin at all
Yea I deleted it and it worked again so I guess you are right about that
So I can just delete the webpack all together?
yep