noblerare
noblerare

Reputation: 11903

CSS modules - no properties in styles object

I have css-loader version 7.1.2 and according to their release notes, I have to structure my code as such:

In my component, I imported the style:

import * as styles from './mycomponent.module.less'

I added the type declaration:

declare module '*.module.less' {
    const classes: { [key: string]: string }
    export = classes
}

My css-loader looks like:

{
    loader: 'css-loader',
    options: {
        url: false,
        modules: {
            auto: /\.module\.\w+$/i, // only enable CSS modules for *.module.* files
            localIdentName: '[name]__[local]--[hash:base64:5]',
        },
    },
}

However, the styles object that comes from the import is completely empty except for just a default property which contains something unhelpful.

Does anyone know what the issue is here?

Upvotes: 0

Views: 24

Answers (0)

Related Questions