Registry / devops / webpack-utf8-bom

webpack-utf8-bom

JSON →
library1.4.0jsnpmunverified

Webpack plugin to add or remove UTF-8 BOM (Byte Order Mark) from output files. Current stable version is 1.4.0, supporting both webpack 4 and 5. Lightweight plugin with a single configuration option (boolean). Differentiator: focused solely on BOM manipulation; alternatives may require custom loaders or post-processing.

npm install webpack-utf8-bom
INSTALL
IMPORT
SIG · WEBPACK-UTF8-BOM
W
webpack-utf8-bom
devopsjavascriptv1.4.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

webpack-utf8-bom
const BomPlugin = require('webpack-utf8-bom');
import BomPlugin from 'webpack-utf8-bom';
Package does not ship ESM; use CommonJS require() in webpack config. Webpack 5's config can use import syntax, but this plugin may not support it.
BomPlugin
new BomPlugin(true)
new BomPlugin({ addBOM: true }) or similar object argument
The constructor expects a boolean argument; true to add BOM, false to remove.

Webpack configuration that adds UTF-8 BOM to bundled output using BomPlugin.

const BomPlugin = require('webpack-utf8-bom'); module.exports = { entry: './src/index.js', output: { path: __dirname + '/dist', filename: 'bundle.js' }, plugins: [ new BomPlugin(true) // Adds UTF-8 BOM to output ] };
Debug
Known issues
breakingWebpack 5 support was added in v1.3.0. v1.4.0 and later require webpack 4.x.x or 5.x.x.
fix
Use at least v1.3.0 for webpack 5 compatibility.
affects: >=1.3.0
gotchaPlugin constructor expects a boolean, not an object. Passing an object will be coerced to true (truthy) and may not behave as expected.
fix
Pass a boolean value: new BomPlugin(true) or new BomPlugin(false).
affects: >=0.0.0
gotchaThe plugin modifies output files after compilation. It does not affect source maps unless explicitly configured.
fix
If you need source maps with BOM, ensure source maps are generated and the BOM plugin runs after.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'webpack-utf8-bom'
Package not installed in node_modules.
fix
Run npm install webpack-utf8-bom --save-dev
TypeError: BomPlugin is not a constructor
Incorrect import: using import statement or destructuring without default.
fix
Use const BomPlugin = require('webpack-utf8-bom');
BomPlugin is not a function
Trying to use plugin without new keyword.
fix
Add new: new BomPlugin(true)
Upgrade
Version history
1.4.0latest on npm
Audit
Dependencies
webpackrequiredpeer dependency required for plugin operation
Agent activity
12 hits · last 30 days
node
10
Resources
webpack-utf8-bom — npm install webpack-utf8-bom · libregistry