vite-sloppy-mode
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

vite-sloppy-mode

一些很老的库采用宽松模式的写法,vite不兼容宽松模式,从而报错

import { glob } from "glob"

var a;
a = 7;
b = 9;
function f() {
  a = 10;
  b = 7;
  c = 12;
}

该插件转换后代码如下:

import { glob } from "glob";
var b, c;
var a;
a = 7;
b = 9;
function f() {
  a = 10;
  b = 7;
  c = 12;
}

用法

import { defineConfig } from "vite";
import viteSloppyMode from "vite-sloppy-mode";

const config = defineConfig({
  plugins: [
    viteSloppyMode({
      // 假设只针对node_modules下的xxx库
      // include、exclude传入格式为: RegExp[]
      include: [/node_modules(.+?)xxx/],
      exclude: []
    })
  ]
})

export default config;

Readme

Keywords

Package Sidebar

Install

npm i vite-sloppy-mode

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

11.8 kB

Total Files

10

Last publish

Collaborators

  • goblin-pitcher