Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
chrisdoble opened this issue Feb 23, 2017 · 4 comments
Closed

Comments

@chrisdoble
Copy link

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.

@alexander-akait
Copy link
Member

@chrisdoble wip

@alexander-akait
Copy link
Member

@chrisdoble fixed 🌟

alexander-akait pushed a commit to alexander-akait/css-loader that referenced this issue Apr 20, 2017
@michael-ciniawsky
Copy link
Member

Fixed by #504

@chrisdoble
Copy link
Author

Awesome, thank you!

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

No branches or pull requests

4 participants