
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
webpack-bem-loader
Advanced tools
Webpack loader for bem-react-core
BEM entities auto resolver for custom import strings:
import Block from 'b:block';
import Block from 'b:block m:modName';
import Block from 'b:block m:modName=modVal1|modVal2';
import BlockElem from 'b:block e:elem';
import BlockElem from 'b:block e:elem m:modName';
import BlockElem from 'b:block e:elem m:modName=modVal1|modVal2';
npm i -D webpack-bem-loader
In your webpack.config.js.
// setting for bem-loader
bemLoader: {
naming: 'react',
levels: ['./pathToBlocks'],
// OR:
// levels: {
// './pathToBlocks': {
// default: true,
// scheme: 'nested',
// naming: 'origin'
// }
// },
techs: ['js', 'css'],
techMap: {
js : ['react.js']
},
langs: ['ru', 'en']
},
// setting for bem-loader
module: {
rules: [
{
test : /\.react\.js$/,
loader: 'webpack-bem-loader',
options: {
naming: 'react',
levels: ['./pathToBlocks'],
// OR:
// levels: {
// './pathToBlocks': {
// default: true,
// scheme: 'nested',
// naming: 'origin'
// }
// },
techs: ['js', 'css'],
techMap: {
js : ['react.js']
},
langs: ['ru', 'en']
}
}
]
}
['js'] by default. First tech will be default export{ 'js' : ['react.js', 'react.ts', 'react.es'], 'css' : ['post.css'] }
Array<String>. This is the list of files of the specified technology, got from current import. Examples: { js : null } or { js: (files) => files.map(file => `require('${file.path}')`).join(',\n') }. Each generator must return String. Check ./generators for examples.
.i18n - represent special technology that provides the opportunity to localize components.
On file system:
blocks/Attach/
├── Attach.react.js
├── Attach.i18n
│ ├── en.js
│ ├── ru.js
│ └── tr.js
└── Attach.spec.js
en.js, ru.js and tr.js are keysets and should be common.js modules.
$ cat blocks/Attach/Attach.i18n/tr.js
module.exports = {
"Attach": {
"button-text": "Dosya seç",
"no-file": "dosya seçilmedi"
}
};
inside Attach.js:
import i18n from `b:Attach t:i18n`
console.log(i18n('button-text')) // → Dosya seç
webpack-bem-loader transpiles such code to
var i18n = (function() {
var core = require('/absolute-path-to/webpack-bem-loader/generators/i18n/core');
if (process.env.BEM_LANG === 'ru') {
return core().decl(require('../Attach.i18n/ru'))('Attach')
}
if (process.env.BEM_LANG === 'en') {
return core().decl(require('../Attach.i18n/en'))('Attach')
}
if (process.env.BEM_LANG === 'tr') {
return core().decl(require('../Attach.i18n/tr'))('Attach')
}
})();
console.log(i18n('button-text')) // → Dosya seç
process.env.BEM_LANG is need to be defined. ru, en and tr are taken from langs option.
FAQs
Webpack BEM loader
The npm package webpack-bem-loader receives a total of 21 weekly downloads. As such, webpack-bem-loader popularity was classified as not popular.
We found that webpack-bem-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.