bem / webpack-bem-loader

Webpack BEM loader
Other
25 stars 14 forks source link

Wrong entity for block_mod inside block__elem #14

Closed iniel closed 7 years ago

iniel commented 7 years ago

Example: _page_content.react.js

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

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

awinogradov commented 7 years ago

@iniel why you need block inside its element?

iniel commented 7 years ago

@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.

awinogradov commented 7 years ago

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

iniel commented 7 years ago

done https://github.com/bem/webpack-bem-loader/pull/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
awinogradov commented 7 years ago

Thanks! :fire: