webpack-encode-plugin

a plugin of webpack to change encoding of your source code in package process.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
webpack-encode-plugin
0.0.26 years ago6 years agoMinified + gzip package size for webpack-encode-plugin in KB

Readme

Webpack Encode Plugin
A useful plugin to encode your file to another encoding from the one of your source code.

Usage

  1. Install

npm install -save-dev webpack-encode-plugin

  1. Example

var EncodePlugin = require('webpack-encode-plugin')

module.exports = {
    ...
    plugins: [
        ...
        new EncodePlugin({
            encoding: 'gbk'
        })
    ]
}

if you want to encode your file to UTF-* with BOM, you can setting like below:
var EncodePlugin = require('webpack-encode-plugin')

module.exports = {
    ...
    plugins: [
        ...
        new EncodePlugin({
            encoding: 'utf-8',
            config: {
                addBOM: true
            }
        })
    ]
}

  1. Others

The encoding module is iconv-lite, here is supported Content-type list.