1.0.0 • Published 3 years ago

vite-plugin-encoding v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Add charset encoding to Vite packaged product files

English | 简体中文

GitHub tag License

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

NameDescriptionTypeDefault
charsetcharset encoding typestringutf-8