vite-plugin-fast-external
Advanced tools
Comparing version 2.1.2 to 2.2.0
{ | ||
"name": "vite-plugin-fast-external", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"description": "Without lexical transform, support custom external code.", | ||
@@ -21,4 +21,8 @@ "main": "index.js", | ||
"plugin", | ||
"external" | ||
"external", | ||
"vue", | ||
"react", | ||
"antd", | ||
"element" | ||
] | ||
} |
@@ -10,2 +10,3 @@ # vite-plugin-fast-external | ||
🌱 Support custom external code | ||
📦 Built in Vue, React, Antd, Element and others, Out of the box | ||
@@ -35,9 +36,44 @@ **English | [简体中文](https://github.com/caoxiemeihao/vite-plugins/blob/main/packages/fast-external/README.zh-CN.md)** | ||
vue: 'Vue', | ||
}) | ||
] | ||
}), | ||
], | ||
} | ||
``` | ||
#### Customize | ||
#### Builtins | ||
You can easily use some builtin modules | ||
```js | ||
import external from 'vite-plugin-fast-external'; | ||
import { | ||
antd_vue_v1, | ||
antd_vue_v3, | ||
antd_v4, | ||
element_plus, | ||
element_ui, | ||
react_dom_v17, | ||
react_dom_v18, | ||
react_v17, | ||
react_v18, | ||
vue_v2, | ||
vue_v3, | ||
} from 'vite-plugin-fast-external/presets'; | ||
export default { | ||
plugins: [ | ||
external({ | ||
'ant-design-vue': antd_vue_v3, | ||
antd: antd_v4, | ||
'element-plus': element_plus, | ||
'element-ui': element_ui, | ||
'react-dom': react_dom_v18, | ||
react: react_v18, | ||
vue: vue_v3, | ||
}), | ||
], | ||
} | ||
``` | ||
#### Customize (Advance) | ||
Support custom external code by function | ||
@@ -47,11 +83,9 @@ | ||
external({ | ||
'element-ui': () => ` | ||
const E = window.ELEMENT; | ||
export { E as default }; | ||
export const Loading = E.Loading; | ||
export const Message = E.Message; | ||
export const MessageBox = E.MessageBox; | ||
export const Notification = E.Notification; | ||
module: () => ` | ||
const M = window.Module; | ||
const D = M.default || M; | ||
export { D as default }; | ||
export const member1 = M.member1; | ||
// other members... | ||
`, | ||
// ...other element-ui members | ||
}) | ||
@@ -58,0 +92,0 @@ ``` |
# vite-plugin-fast-external | ||
[![npm package](https://nodei.co/npm/vite-plugin-fast-external.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/vite-plugin-fast-external) | ||
<br/> | ||
[![NPM version](https://img.shields.io/npm/v/vite-plugin-fast-external.svg?style=flat)](https://npmjs.org/package/vite-plugin-fast-external) | ||
[![NPM Downloads](https://img.shields.io/npm/dm/vite-plugin-fast-external.svg?style=flat)](https://npmjs.org/package/vite-plugin-fast-external) | ||
🚀 **高性能** 不需要语法转换 | ||
🚀 **高性能** 不需要语法转换 | ||
🌱 支持自定义 external 代码段 | ||
📦 内置 Vue, React, Antd, Element 等等, 开箱即用 | ||
@@ -34,9 +33,44 @@ **[English](https://github.com/caoxiemeihao/vite-plugins/tree/main/packages/fast-external#readme) | 简体中文** | ||
vue: 'Vue', | ||
}) | ||
] | ||
}), | ||
], | ||
}) | ||
``` | ||
#### 自定义 | ||
#### 内置模块 | ||
已经内置的一些常用的模块 | ||
```js | ||
import external from 'vite-plugin-fast-external'; | ||
import { | ||
antd_vue_v1, | ||
antd_vue_v3, | ||
antd_v4, | ||
element_plus, | ||
element_ui, | ||
react_dom_v17, | ||
react_dom_v18, | ||
react_v17, | ||
react_v18, | ||
vue_v2, | ||
vue_v3, | ||
} from 'vite-plugin-fast-external/presets'; | ||
export default { | ||
plugins: [ | ||
external({ | ||
'ant-design-vue': antd_vue_v3, | ||
antd: antd_v4, | ||
'element-plus': element_plus, | ||
'element-ui': element_ui, | ||
'react-dom': react_dom_v18, | ||
react: react_v18, | ||
vue: vue_v3, | ||
}), | ||
], | ||
} | ||
``` | ||
#### 自定义(高级部分) | ||
支持通过 function 返回自定义 external 代码 | ||
@@ -46,11 +80,9 @@ | ||
external({ | ||
'element-ui': () => ` | ||
const E = window.ELEMENT; | ||
export { E as default }; | ||
export const Loading = E.Loading; | ||
export const Message = E.Message; | ||
export const MessageBox = E.MessageBox; | ||
export const Notification = E.Notification; | ||
module: () => ` | ||
const M = window.Module; | ||
const D = M.default || M; | ||
export { D as default }; | ||
export const member1 = M.member1; | ||
// 其他成员... | ||
`, | ||
// ...其他 element-ui 导出成员 | ||
}) | ||
@@ -57,0 +89,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
33698
18
1353
117