https://github.com/yoshiyukikato/webpack-iconv-plugin
Webpack plugin to change encoding of output files
https://github.com/yoshiyukikato/webpack-iconv-plugin
iconv webpack
Last synced: about 2 months ago
JSON representation
Webpack plugin to change encoding of output files
- Host: GitHub
- URL: https://github.com/yoshiyukikato/webpack-iconv-plugin
- Owner: YoshiyukiKato
- Created: 2017-05-23T09:50:31.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-23T11:29:40.000Z (about 9 years ago)
- Last Synced: 2026-04-30T08:27:16.306Z (2 months ago)
- Topics: iconv, webpack
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# webpack-iconv-plugin
Webpack plugin to change encoding of output. This plugin depends on [node-iconv](https://github.com/bnoordhuis/node-iconv#supported-encodings).
# Usage
```js
//webpack.config.js
const WebpackIconvPlugin = require("webpack-iconv-plugin");
module.exports = {
//...your webpack config
plugins: [
new WebpackIconvPlugin("UTF-8", "SHIFT-JIS", "TRANSLIT", { "\\\\" : "¥" })
]
};
```
## WebpackIconvPlugin(from, to, whenUntranslatable, preReplaceMap)
### from/to
Encoding of input and output. See [here](https://github.com/bnoordhuis/node-iconv#supported-encodings) to know supported encordings.
### whenUntranslatable
How to deal with an input including untranslatable chars. See [here](https://github.com/bnoordhuis/node-iconv#supported-encodings) to know available settings.
- TRANSLIT
- IGNORE
### preReplaceMap
Correspondence table of chars to replace before translation.
For instance, in case of converting from `UTF-8` to `SHIFT-JIS`, `\` could not be translated. To escape characters, `SHIFT-JIS` uses `¥` instead of `\`.
We want to replace `\` as `¥` before translation of iconv. In this case, we pass a map of chars:
```js
{
"\\\\" : "¥"
}
```
## LICENSE
MIT