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

Build produces invalid output with localsConvention value of camelCase #1071

Closed
danrot opened this issue Apr 7, 2020 · 2 comments · Fixed by #1072
Closed

Build produces invalid output with localsConvention value of camelCase #1071

danrot opened this issue Apr 7, 2020 · 2 comments · Fixed by #1072

Comments

@danrot
Copy link

danrot commented Apr 7, 2020

  • Operating System: ArchLinux
  • Node Version: 13.11.0
  • NPM Version: 6.14.2
  • webpack Version: 4.42.1
  • css-loader Version: 3.5.0

Expected Behavior

I want to have a working build.

Actual Behavior

Instead of a working build I get a few errors like the following since the release of 3.5.0:

You may need an additional loader to handle the result of these loaders.
| exports.locals = {
| 	"select": "select--2hibluCduK",
> 	"options-list": "options-list--2Jo8LXWh5s"	"optionsList": "options-list--2Jo8LXWh5s"
| };
| module.exports = exports;
 @ ./src/Sulu/Bundle/AdminBundle/Resources/js/components/Select/select.scss 2:26-187
 @ ./src/Sulu/Bundle/AdminBundle/Resources/js/components/Select/Select.js
 @ ./src/Sulu/Bundle/AdminBundle/Resources/js/components/Select/index.js
 @ ./src/Sulu/Bundle/AdminBundle/Resources/js/components/MultiSelect/MultiSelect.js
 @ ./src/Sulu/Bundle/AdminBundle/Resources/js/components/MultiSelect/index.js
 @ ./src/Sulu/Bundle/AdminBundle/Resources/js/components/index.js
 @ ./src/Sulu/Bundle/MediaBundle/Resources/js/components/MimeTypeIndicator/MimeTypeIndicator.js
 @ ./node_modules/react-styleguidist/lib/loaders/styleguide-loader.js!./node_modules/react-styleguidist/lib/client/index.js
 @ ./node_modules/react-styleguidist/lib/client/index.js
 @ multi regenerator-runtime/runtime ./src/Sulu/Bundle/AdminBundle/Resources/js/containers/Application/global.scss ./src/Sulu/Bundle/AdminBundle/Resources/js/containers/Application/styleguidist.scss ./node_modules/react-styleguidist/lib/client/index
n

It seems like a comma is not inserted when using localsConvention: 'camelCase' as an option.

Code

.options-list {
    // unrelated properties
}

How Do We Reproduce?

  1. Create a class with a dash
  2. Use the localsConvention: 'camelCase' option of the css-loader
  3. See an error like the one I've pasted above
@forehalo
Copy link

forehalo commented Apr 7, 2020

met the same issue, and I found it was caused by this commit: 1b29b28#diff-2b4ca49d4bb0a774c4d4c1672d7aa781R331

Two indexes passed to addExportToLocalsCode in camelCase arm are both recognized as last index if camcelCase(name) is not equal to name.

Temporary fixing: use camcelCaseOnly if your code didn't rely on origin name exported by your css

@alexander-akait
Copy link
Member

Thanks, WIP

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

Successfully merging a pull request may close this issue.

3 participants