Skip to content

CSS Module composes imports aren't added to webpack #170

Closed
@delijah

Description

@delijah

This is a copy of webpack-contrib/css-loader#286. I think this issue applies to css-modules as well:

Say there's a project like this:

/* a.css */
.red { color: red };

/* b.css */
.main { composes: red from './a.css'; }

and a config roughly like:

module: {
  loaders: [
    {
      test: /a\.css$/,
      loader: 'style-loader!css-loader?modules&localIdentName=a--[local]',
    },
    {
      test: /b\.css$/,
      loader: 'style-loader!css-loader?modules&localIdentName=b--[local]',
    },
  ]
}

a.css will be processed by b.css' loader config even though it does't match the file test. This results in the equivalent of:

.b--red { color: red; }
.b--main { };

even though I'd expect the output to look like:

.a--red { color: red; }
.b--main { };

Ideally css-loader should webpack.addDependency for css module source dependencies so they get processed with the same set of loaders as the rest of the config and not jus the root file's loader url.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions