Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
Class names via CSS modules are generated in a strange way

I configured CSS-modules via webpack, but as a result, the class names look wrong.

It feels like webpack is not responding to them. Although it should look something like this: class="Input-input_ytoew" but you can see the result yourself.

webpack
----------
module.exports = {
  module: {
    rules: [
      {
        test: /\.s?css$/,
        use: [
          "style-loader",
          {
            loader: "css-loader",
            options: {
              sourceMap: true,
              importLoaders: 1,
              modules: true,
            },
          },
        ],
        include: /\.module\.scss$/,
      },
      {
        test: /\.s?css$/,
        use: ["style-loader", "css-loader"],
        exclude: /\.module\.scss$/,
      },
    ],
  },
};


Input.stx
----------
import React from "react";

import s from "./Input.module.scss";

export const Input = ({ value }: any) => {
  return (
    <>
      <input className={s.input} type="text" value={value} />
    </>
  );
};
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

See localIdentName of css-loader. The property is responsible for generating the class names.

I'd usually go with:

{
    loader: 'css-loader',
    options: {
        modules: {
            localIdentName:'[name]__[local]--[hash:base64:5]',
        },
    },
},
about 4 years ago · Juan Pablo Isaza Report

0

Solution

     {
        test: /\.css$/,
        use: [
          {
            loader: 'style-loader',
          },
          {
            loader: 'css-loader',
            options: {
              modules: {
                localIdentName: '[local]--[hash:base64:5]',
              },
            },
          },
        ],
      },
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!