I am using latest Next.js and sass (scss) in my project. Here is next.config.ts configuration:
import type { NextConfig } from 'next';
import createNextIntlPlugin from 'next-intl/plugin';
import '~/env';
const nextConfig: NextConfig = {
webpack: config => {
// Add svgr loader
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
});
return config;
},
images: {
// https://nextjs.org/docs/pages/api-reference/components/image#devicesizes
deviceSizes: [360, 430, 576, 768, 992, 1440, 1920],
// https://nextjs.org/docs/messages/next-image-unconfigured-host
remotePatterns: [
// ...
],
},
// https://sass-lang.com/d/legacy-js-api
// https://github.com/vercel/next.js/issues/71638#issuecomment-2431137842
sassOptions: {
silenceDeprecations: ['legacy-js-api'],
},
experimental: {
turbo: {
rules: {
'*.svg': {
loaders: ['@svgr/webpack'],
as: '*.js',
},
},
},
},
};
const withNextIntl = createNextIntlPlugin('./src/shared/config/i18n/request.ts');
export default withNextIntl(nextConfig);
Also I am using Turbopack in development mode.
I am getting this output for generated scss class names...
Container-module-scss-module__5CxIxW__root
Header-module-scss-module__4xIsZW__content
... and I want it to be somewhat like this:
Container-5CxIxW__root
Header-4xIsZW__content
Is it possible to achieve?
I've already tried multiple strategies:
- Push new webpack rules for
*.scss - Configuring
localIdentName - Configuring postcss