# webpack-encoding-plugin

> Control Webpacks output encoding

Latest version **0.3.1** (published 2019-03-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install webpack-encoding-plugin
pnpm add webpack-encoding-plugin
yarn add webpack-encoding-plugin
bun add webpack-encoding-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2019-03-13 |
| First published | 2015-11-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Tobias Wingerter |
| Maintainers | quackes |
| Keywords | webpack, encoding |

## Links

- npm: https://www.npmjs.com/package/webpack-encoding-plugin
- Repository: https://github.com/quackes/webpack-encoding-plugin
- Homepage: https://github.com/quackes/webpack-encoding-plugin#readme
- Issues: https://github.com/quackes/webpack-encoding-plugin/issues
- npm.io page: https://npm.io/package/webpack-encoding-plugin

## Dependencies (3)

- [webpack](https://npm.io/package/webpack.md) ^4.29.5
- [encoding](https://npm.io/package/encoding.md) ^0.1.12
- [webpack-sources](https://npm.io/package/webpack-sources.md) ^1.3.0

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 0.3.1 (latest) — 2019-03-13
- 0.3.0 — 2019-03-10
- 0.2.1 — 2017-01-23
- 0.2.0 — 2016-07-19
- 0.0.2 — 2016-03-15
- 0.0.1 — 2015-11-13

## README

![Build Status](https://travis-ci.org/quackes/webpack-encoding-plugin.svg?branch=master)

# Webpack Encoding Plugin

Take control over the encoding of emitted webpack assets.
This can be useful, if the delivering webserver enforces a specific content-type,
so that your js-code is not interpreted as utf-8 by the browser.

## Usage

install module

    npm install webpack-encoding-plugin

setup webpack config

``` javascript
const EncodingPlugin = require('webpack-encoding-plugin');
module.exports = {
    entry: './entry.js',
    output: {
        path: '../dist',
        filename: 'bundle.js'
    },
    plugins: [new EncodingPlugin({
        encoding: 'iso-8859-1'
    })]
};
```

Additional options:

`test`, `include`, `exclude` RegExp or array of RegExps to filter processed files
(default `test` is `/(\.js|\.css)($|\?)/i`)

## Encodings

The Plugin uses [iconv-lite](https://www.npmjs.com/package/iconv-lite) to handle the encoding.
A list of supported encodings can be found [here](https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings)

## webpack-dev-server

To use non-utf-8 encoding with webpack-dev-server, you must set the appropriate charset like so:

``` JavaScript
devServer:  {
   headers: {
      'Access-Control-Allow-Origin': '*',
      'Content-Type': 'application/javascript; charset=windows-1251'
   }
   // ...
}
```

---
_Source: https://npm.io/package/webpack-encoding-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
