Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including webpack-utf8-bom with all npm packages installed. Try it out:

require("webpack/package.json"); // webpack is a peer dependency. var webpackUtf8Bom = require("webpack-utf8-bom")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

webpack-utf8-bom v1.2.0

ADD OR REMOVE BOM FOR WEBPACK

webpack-utf8-bom

ADD OR REMOVE BOM FOR WEBPACK

I use a Windows PC for work in company.

It creates file with BOM.

However the files generated by Webpack do not contain the BOM.

So I write this plugin for Webpack so that it can add or remove BOM automatically when generates files, by default only files matching the /\.(html|htm|css|js|map)$/ pattern are processed.

Usage

In webpack config file:

var webpack = require('webpack');

// import plugin
var BomPlugin = require('webpack-utf8-bom');

module.exports = {
  // ...
  plugins: [
    // Add plugin in plugins list
    // true for adding bom
    // false for removing bom
    new BomPlugin(true)
  ],
 // ...
};
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free