Closed poka93 closed 1 year ago
Same situation here with leaflet, after using withAntdLess
.
You missed the important line on your error log, just above Module parse failed…. Mine is :
./node_modules/leaflet/dist/images/layers-2x.png
On next.config.js, update your webpack configuration to load images (ref, assuming webpack 5)
webpack: (config, options) => {
config.module.rules.push(
{
test: /\.(png|jpg|jpeg|gif)$/i,
type: 'asset/resource',
//Output in static folder, otherwise you won't be served, thus no access from css url()
//https://stackoverflow.com/a/68537419/1437016
generator: {
filename: 'static/[name].[ext]',
}
}
);
// Returns the customized Next.js configuration
return config;
},
Antd theming is working 🥳 but I am not able to import CSS files from node modules anymore, some of them are broken (the ones that use
url()
).In my Nextjs app there is Antd with less for theme and I am using leaflet react but I am having the following error during build:
Error during build
I tried to configure the cssLoaderOptions in next.config.js but couldn't fix it by adding url: true (it is already set to true by default 🤷♂️). Any documentation on how to do it please.
next.config.js