vite-plugin-legacy-dev
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

vite-plugin-legacy-dev

Maybe your Vite project needs work on IE11 or other not support ESM legacy browsers, this plugin can help you!

This is only for development.

Install

# npm
npm i vite-plugin-legacy-dev -D

# or yarn
yarn add vite-plugin-legacy-dev -D

# or pnpm
pnpm i vite-plugin-legacy-dev -D

Usage

Add the plugin to your Vite config. For example:

vite.config.ts

import { defineConfig } from 'vite'
import legacyDev from 'vite-plugin-legacy-dev'

export default defineConfig({
  plugins: [
    legacyDev()
  ]
})

Plugin introduction

When you access then HTML entry file, this plugin will:

  • Inject core-js@3(bundle) polyfill.
  • Inject feach API polyfill.
  • Inject webcomponents polyfill.
  • Change <script type="module"> to <script type="systemjs-module"> and inject systemjs(Dynamic ES module loader).

Next, the plugin will use Babel to transform your js/ts code to SystemJS module(the process can be slow when transform large files).

Other

If you are interested in this project, your ideas are welcome!

License

MIT

Package Sidebar

Install

npm i vite-plugin-legacy-dev

Weekly Downloads

1

Version

0.0.4

License

none

Unpacked Size

12.1 kB

Total Files

12

Last publish

Collaborators

  • xieyuhang