{"id":20848,"library":"webpack-utf8-bom","title":"webpack-utf8-bom","description":"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.","status":"active","version":"1.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/cqqccqc/webpack-utf8-bom","tags":["javascript","webpack","plugin","utf8","bom"],"install":[{"cmd":"npm install webpack-utf8-bom","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-utf8-bom","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-utf8-bom","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required for plugin operation","package":"webpack","optional":false}],"imports":[{"note":"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.","wrong":"import BomPlugin from 'webpack-utf8-bom';","symbol":"webpack-utf8-bom","correct":"const BomPlugin = require('webpack-utf8-bom');"},{"note":"The constructor expects a boolean argument; true to add BOM, false to remove.","wrong":"new BomPlugin({ addBOM: true }) or similar object argument","symbol":"BomPlugin","correct":"new BomPlugin(true)"}],"quickstart":{"code":"const BomPlugin = require('webpack-utf8-bom');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: __dirname + '/dist',\n    filename: 'bundle.js'\n  },\n  plugins: [\n    new BomPlugin(true) // Adds UTF-8 BOM to output\n  ]\n};","lang":"javascript","description":"Webpack configuration that adds UTF-8 BOM to bundled output using BomPlugin."},"warnings":[{"fix":"Use at least v1.3.0 for webpack 5 compatibility.","message":"Webpack 5 support was added in v1.3.0. v1.4.0 and later require webpack 4.x.x or 5.x.x.","severity":"breaking","affected_versions":">=1.3.0"},{"fix":"Pass a boolean value: new BomPlugin(true) or new BomPlugin(false).","message":"Plugin constructor expects a boolean, not an object. Passing an object will be coerced to true (truthy) and may not behave as expected.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"If you need source maps with BOM, ensure source maps are generated and the BOM plugin runs after.","message":"The plugin modifies output files after compilation. It does not affect source maps unless explicitly configured.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install webpack-utf8-bom --save-dev","cause":"Package not installed in node_modules.","error":"Error: Cannot find module 'webpack-utf8-bom'"},{"fix":"Use const BomPlugin = require('webpack-utf8-bom');","cause":"Incorrect import: using import statement or destructuring without default.","error":"TypeError: BomPlugin is not a constructor"},{"fix":"Add new: new BomPlugin(true)","cause":"Trying to use plugin without new keyword.","error":"BomPlugin is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}