Skip to content
This repository was archived by the owner on Aug 28, 2026. It is now read-only.
This repository was archived by the owner on Aug 28, 2026. It is now read-only.

Imported variables aren't replaced in exports if followed by a comma #424

Closed

Description

@chrisdoble

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

If an exported value contains a reference to an imported value followed by a comma, the reference to the imported value isn't replaced.

If the current behavior is a bug, please provide the steps to reproduce.

See chrisdoble/css-loader-bug.

What is the expected behavior?

In the example repository above, I expected the first occurrence of the color variable to be replaced with the value of the color variable.

Please mention other relevant information such as your webpack version, Node.js version and Operating System.

webpack: 2.2.1
Node.js: 7.6.0
OS: OS X 10.10.5

I believe this issue is caused by incorrect tokenisation here, e.g.

> "0 0 color, 0 0 color".split(/(\S+)/)
["", "0", " ", "0", " ", "color,", " ", "0", " ", "0", " ", "color", ""]

Note that the first occurrence of the color variable includes a trailing comma which will cause the import lookup to fail.

Activity

  1. alexander-akait commented on Apr 20, 2017

    @alexander-akait
    Member
  2. alexander-akait commented on Apr 20, 2017

    @alexander-akait
    Member

    @chrisdoble fixed 🌟

  3. michael-ciniawsky commented on Apr 20, 2017

    @michael-ciniawsky
    Contributor

    Fixed by #504

  4. chrisdoble commented on Apr 24, 2017

    @chrisdoble
    Author

    Awesome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions