vite-plugin-encoding
v1.0.0
Published
Solve the problem that when the server is `Content-Type: text/html; charset=GB2312`, Chinese garbled characters in the `js` file introduced by the page cause page rendering failure.
Downloads
61
Maintainers
Readme
Add charset encoding to Vite packaged product files
English | 简体中文
Solve the problem that when the server is Content-Type: text/html; charset=GB2312
, Chinese garbled characters in the js
file introduced by the page cause page rendering failure.
Installation
Install the plugin with npm:
npm install vite-plugin-encoding --save-dev
or yarn
yarn add vite-plugin-encoding -D
ReactUse demo
// vite.config.js
import encodingPlugin from 'vite-plugin-encoding'
export default {
plugins: [
encodingPlugin(),
],
}
VueUse demo
// vite.config.js
import vue from '@vitejs/plugin-vue'
import encodingPlugin from 'vite-plugin-encoding'
export default {
plugins: [
vue(),
encodingPlugin(),
],
}
Options
| Name | Description | Type | Default | | ------- | --------------------- | ------ | ------- | | charset | charset encoding type | string | utf-8 |