Skip to content

Classes with composes break the exports (for the plugin) #207

Closed
@calvellido

Description

@calvellido

Description

CSS Modules files with any class that include the composes keyword break the export for that file, in the context of the plugin. As noted, not only the class that include that keyword doesn't seem visible to the plugin, but any on the same file too. The three types of possible origin for the composes setting: from the same file, other files, or global classes produce the same result of an empty object {} as the object exported.

The composes keyword is defined in the CSS Modules spec in:

https://github.com/css-modules/css-modules#dependencies

It's also supported through Webpack's CSS Loader in:

https://webpack.js.org/loaders/css-loader/#composing


The project builds the classes including these composed classes correctly and as expected through the use of the webpack loader and config.


To Reproduce

Steps to reproduce the behaviour:

  1. Define a CSS Modules file, e.g: index.module.css
  2. Set the composes keyword in one of its classes, e.g: cardContainer
  3. Import the CSS Module file on a TS file, e.g: import styles from './index.module.css';
  4. Use any of the classes exported by the CSS Module, e.g: textContainer
  5. Property 'textContainer' does not exist on type '{}'.ts(2339)

Expected behaviour

Classes should still be understood as exported as usual, whether some of them include the composes keyword or not.

Screenshots

Error with composes:
image
image

Usual behaviour:
image
image

Desktop

  • OS: GNU/Linux, Linux Mint 21.1 Cinnamon
  • Editor: VS Code 1.75.1
  • Browser: Not applicable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions