Next.js Discord

Discord Forum

change auto generated class names by next.js

Unanswered
Narrow-barred Spanish mackerel posted this in #help-forum
Open in Discord
Avatar
Narrow-barred Spanish mackerelOP
how can i change the auto generated class names by next.js?

18 Replies

Avatar
I think its a xy question.
https://xyproblem.info
Avatar
Narrow-barred Spanish mackerelOP
i dont know what you mean
Avatar
click the link
Avatar
Narrow-barred Spanish mackerelOP
i am not asking about any attempted solution
i am asking how to change the auto generated class names by next.js
Avatar
Why do you want to do it?
Avatar
Narrow-barred Spanish mackerelOP
because i do not like the current class names
Avatar
Can I know which className are you referring to, like which auto generated one?
Avatar
Narrow-barred Spanish mackerelOP
this for example
Image
Avatar
Can you share your code
Avatar
Narrow-barred Spanish mackerelOP
i havent tried to change it yet, because i dont know how
Avatar
What is the current code of your file of the route?
Avatar
Narrow-barred Spanish mackerelOP
well, i tried but it does not add the new classnames to the html elements
config.module.rules.push( {
  test: /\.css$/i,
  loader: "css-loader",
  options: {
    modules: {
      localIdentName: "[hash:base64]",
    },
  },
})
shouldnt matter
Avatar
These are my classNames then. I can't reproduce this issue without it
Image
Avatar
Narrow-barred Spanish mackerelOP
this is just a normal module css name, {styles.landingPage}
Avatar
Thats how the file.module.css is built.

It is supposed to generate a random style, so it doesn't clash with another one.

You can just use import "styles.css"
as far as I know, there is no way to change this with your approach