Skip to content

Object field names with double underscore are compiled incorrectly #6005

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

Closed
DZakh opened this issue Feb 13, 2023 · 0 comments
Closed

Object field names with double underscore are compiled incorrectly #6005

DZakh opened this issue Feb 13, 2023 · 0 comments

Comments

@DZakh
Copy link
Member

DZakh commented Feb 13, 2023

@module external css: {..} = "./PriceSwitcher.module.scss"

Js.log(css["priceMode_left"])
Js.log(css["priceMode__left"])
Js.log(css["priceMode__foo___left"])

Compiled to the following js:

var css = require("./PriceSwitcher.module.scss");

console.log(css.priceMode_left);
console.log(css.priceMode);
console.log(css.priceMode__foo_);

The second and the third console logs have incorrect field names. The playground: https://rescript-lang.org/try?version=v10.1.2&code=AIWw9gJgrgNgpgAjgDwC5wE4DsCGMEDGAzkQFwIDeAdFQL4IC8CARFQPQAKGAlgXAMoB3bqgIALTFXDR4VIsSLMAUEoBSRKjDABzABQKA2swAOPPgFlIcAPrwAZqmYBdAJRqNWvYZNm4liDa2cA7ObuqaOvokRqa8flbW1nZgYIlBIa5KQA

I've tried different versions, and it works incorrectly for all of them.

This is a common case when using the BEM methodology together with css modules.

@DZakh DZakh changed the title Object names with double underscore in field name compiled incorrectly Object field names with double underscore are compiled incorrectly Feb 13, 2023
@DZakh DZakh closed this as completed Aug 19, 2023
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

No branches or pull requests

1 participant