
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
@bem-react/pack
Advanced tools
A tool for building and prepare components for publishing.
via npm:
npm i -DE @bem-react/pack
via yarn:
yarn add -D @bem-react/pack
Runs components build with defined plugins.
USAGE
$ pack build
OPTIONS
-c, --config=config [default: build.config.json] The path to a build config file.
An example configuration:
const { resolve } = require('path')
const { useCleanUpPlugin } = require('@bem-react/pack/lib/plugins/CleanUpPlugin')
const { useCopyAssetsPlugin } = require('@bem-react/pack/lib/plugins/CopyAssetsPlugin')
const { useCssPlugin } = require('@bem-react/pack/lib/plugins/CssPlugin')
const { useTypeScriptPlugin } = require('@bem-react/pack/lib/plugins/TypescriptPlugin')
/**
* @type {import('@bem-react/pack/lib/interfaces').Config}
*/
module.exports = {
context: resolve(__dirname, '..'),
output: './dist',
plugins: [
useCleanUpPlugin(['./dist']),
useTypeScriptPlugin({
configPath: './tsconfig.prod.json',
}),
useCssPlugin({
context: './src',
src: './**/*.css',
output: ['./dist', './dist/esm'],
}),
useCopyAssetsPlugin([
{
context: './src',
src: './**/*.{svg,md,json}',
output: ['./dist', './dist/esm'],
},
]),
],
}
type Config = {
/**
* Executing context.
*
* @default cwd
*/
context?: string
/**
* Output directory.
*/
output: string
/**
* Plugins list.
*/
plugins: Plugin[]
}
Plugin for cleanuping directories. (Run at beforeRun step).
const { useCleanUpPlugin } = require('@bem-react/pack/lib/plugins/CleanUpPlugin')
useCleanUpPlugin(['./dist'])
/**
* A list of directories which need to be cleaned.
*/
type Sources = string[]
export declare function useCleanUpPlugin(sources: Sources): CleanUpPlugin
Plugin for copying assets. (Run at afterRun step).
const { useCopyAssetsPlugin } = require('@bem-react/pack/lib/plugins/CopyAssetsPlugin')
useCopyAssetsPlugin([
{
context: './src',
src: './**/*.{svg,md,json}',
output: ['./dist', './dist/esm'],
},
])
type Rule = {
/**
* Glob or path from where we сopy files.
*/
src: string
/**
* Output paths.
*/
output: string[]
/**
* A path that determines how to interpret the `src` path.
*/
context?: string
/**
* Paths to files that will be ignored when copying.
*/
ignore?: string[]
}
type Rules = Rule | Rule[]
function useCopyAssetsPlugin(rules: Rules): CopyAssetsPlugin
A plugin that copies css files and makes processing using postcss on demand. (Run at run step).
const { useCssPlugin } = require('@bem-react/pack/lib/plugins/CssPlugin')
useCssPlugin({
context: './src',
src: './**/*.css',
})
type Options = {
/**
* A path that determines how to interpret the `src` path.
*/
context?: string
/**
* Glob or path from where we сopy files.
*/
src: string
/**
* Output paths.
*/
output: string[]
/**
* Paths to files that will be ignored when copying and processing.
*/
ignore?: string[]
/**
* A path to postcss config.
*/
postcssConfigPath?: string
}
export declare function useCssPlugin(options: Options): CssPlugin
A plugin that process ts and creates two copies of the build (cjs and esm). (Run at run step).
const { useTypeScriptPlugin } = require('@bem-react/pack/lib/plugins/TypescriptPlugin')
useTypeScriptPlugin({
configPath: './tsconfig.prod.json',
})
type Options = {
/**
* A path to typescript config.
*/
configPath?: string
/**
* A callback for when creating side effects.
*/
onCreateSideEffects: (path: string) => string[] | boolean | undefined
}
function useTypeScriptPlugin(options: Options): TypeScriptPlugin
A plugin that copy package.json and modify content. (Run at onFinish step).
const { usePackageJsonPlugin } = require('@bem-react/pack/lib/plugins/PackageJsonPlugin')
usePackageJsonPlugin({
scripts: {},
})
The plugin can perform an action on one of the available hook onBeforeRun, onRun and onAfterRun.
import { Plugin, OnDone, HookOptions } from '@bem-raect/pack/lib/interfaces'
class MyPlugin implements Plugin {
async onRun(done: OnDone, { context, output }: HookOptions) {
// Do something stuff.
done()
}
}
export function useMyPlugin(): MyPlugin {
return new MyPlugin()
}
type OnDone = () => void
type HookOptions = { context: string; output: string }
type HookFn = (done: OnDone, options: HookOptions) => Promise<void>
interface Plugin {
/**
* Run hook at start.
*/
onStart?: HookFn
/**
* Run hook before run.
*/
onBeforeRun?: HookFn
/**
* Run hook at run.
*/
onRun?: HookFn
/**
* Run hook after run.
*/
onAfterRun?: HookFn
/**
* Run hook at finish.
*/
onFinish?: HookFn
}
FAQs
A tool for building and prepare components for publishing
The npm package @bem-react/pack receives a total of 28 weekly downloads. As such, @bem-react/pack popularity was classified as not popular.
We found that @bem-react/pack demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.