Skip to content

[2.0.0] URL used multiple times across imported files produces "undefined" rather than expected URL. #864

Description

@Lattyware

After upgrading to 2.0.0 from 1.0.1, I am getting url(undefined) in my output CSS where I previously got a valid URL.

This seems to happen when the URL is referenced multiple times across imported files - after the first reference undefined is output.

  • Operating System: Arch Linux
  • Node Version: 11.3.0
  • NPM Version: 6.4.1
  • webpack Version: 4.27.1
  • css-loader Version: 2.0.0

Expected Behavior

The URL should be the same each time it is referenced.

Actual Behavior

undefined is output instead of the URL after the first reference.

Code

@import "./test2";

.test1 {
    background: url(../../assets/test.png);
}
.test2 {
    background: url(../../assets/test.png) repeat;
}

Produces:

With css-loader@2.0.0:

.test2{background:url(d41d8cd98f00b204e9800998ecf8427e.png) repeat}.test1{background:url(undefined)}

With css-loader@1.0.1:

.test2{background:url(d41d8cd98f00b204e9800998ecf8427e.png) repeat}.test1{background:url(d41d8cd98f00b204e9800998ecf8427e.png)}

How Do We Reproduce?

See the attached project, which works with css-loader@1.0.1 but fails with css-loader@2.0.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions