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

fix(build): fix minification issues in classname pkg #606

Merged
merged 1 commit into from
May 21, 2021

Conversation

gridsane
Copy link
Contributor

We found an issue in the .min build of @bem-react/classname package.

classname.development.js:

cn('block')({ mod: '1' }) // block__mod_1

classname.production.min.js:

cn('block')({ mod: '1' }) // block__mod

This happens because of booleans_as_integers terser option.

This expression:

if (modVal === true) {
    className += modPrefix + k;
} else {
    <...>
}

Transforms to:

1 == p ? v += u + s : <...>

It's impossible to use mod values '1' or 1 with such transform.

Full diff with and without booleans_as_integers option: https://www.diffchecker.com/2XzvNEZg

Copy link
Member

@yarastqt yarastqt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@yarastqt yarastqt merged commit 2f2427c into bem:master May 21, 2021
@gridsane gridsane deleted the patch-1 branch May 22, 2021 06:53
@gridsane
Copy link
Contributor Author

@yarastqt could you please publish @bem-react/classname with this fix?

@yarastqt
Copy link
Member

yarastqt commented Jun 8, 2021

Available start from:

 - @bem-react/classname@1.5.11
 - @bem-react/classnames@1.3.10
 - @bem-react/core@3.0.7
 - @bem-react/di@2.2.7

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 this pull request may close these issues.

None yet

2 participants