bem/webpack-bem-loader

Wrong entity for block_mod inside block__elem

iniel opened this issue · 5 comments

iniel commented

Example:
page__content.react.js

import 'b:page m:theme=normal';
...

--> { block: 'b-page', elem: 'content', modName: 'theme', modVal: 'normal' }

@iniel why you need block inside its element?

iniel commented

@awinogradov I need block's modifier inside an element. The use case is somewhat complex to give the full context here, however it's irrelevant anyway, because the issue is the unexpected behaviour.
When I use short syntax, I expect loader complete it.
When I use full syntax, I expect to get the entity exactly as it was explicitly specified.

@iniel ok, can you make PR to examples with your use case? it's the way to understand and solve this problem.

iniel commented

done #15

webpack ./entry.js bundle.js

ERROR in ./common.blocks/page/__content/page__content.js
Module build failed: Error: No BEM entity: "page__content_theme_normal"
    at /Users/sekolosova/Documents/MakeUp/react/webpack-bem-loader/index.js:71:39
    at Array.reduce (native)
    at /Users/sekolosova/Documents/MakeUp/react/webpack-bem-loader/index.js:69:64
    at Array.<anonymous> (/Users/sekolosova/Documents/MakeUp/react/webpack-bem-loader/node_modules/vow/lib/vow.js:713:56)
    at Immediate.callFns [as _onImmediate] (/Users/sekolosova/Documents/MakeUp/react/webpack-bem-loader/node_modules/vow/lib/vow.js:24:35)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
 @ ./entry.js 2:28-153 3:31-156 4:31-156

Thanks! 🔥