Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
vite-plugin-fast-external
Advanced tools
Readme
English | 简体中文
📦 Out of the box, built in Vue, React, Antd, Element and others
🚀 High performance, without lexical transform
🌱 Support custom external code
✅ Browser, Node.js, Electron
npm i vite-plugin-fast-external -D
You can easily use builtin modules
import external from 'vite-plugin-fast-external'
import {
antd_vue_v1,
antd_vue_v3,
antd_v4,
element_plus,
element_ui,
pinia_v2,
react_dom_v17,
react_dom_v18,
react_router_dom_v5,
react_router_dom_v6,
react_router_v5,
react_router_v6,
react_v17,
react_v18,
redux_v5,
vue_composition_api,
vue_router_v4,
vue_v2,
vue_v3,
vuex_v3,
vuex_v4,
} from 'vite-plugin-fast-external/presets'
export default {
plugins: [
external({
vue: vue_v3,
// ...others
}),
],
}
In your App
// Vue v3
import { ref, reactive, watch } from 'vue'
// ...others
If you want to modify the builtin module
import external from 'vite-plugin-fast-external'
import { lib2external } from 'vite-plugin-fast-external/presets'
import vue_v2 from 'vite-plugin-fast-external/presets/vue-v2'
interface Vue_v2 extends LibMeta {
name: string
members: string[]
}
vue_v2.name = 'ExtendVue'
vue_v2.members.push('ExtendAPI')
export default {
plugins: [
external({
vue: lib2external(vue_v2.name, vue_v2.members),
// ...others
}),
],
}
Use lib2external
import { lib2external } from 'vite-plugin-fast-external/presets'
external({
module: lib2external('Module', [
'member1',
// ...others
]),
})
Be equivalent to
external({
module: () => `
const M = window.Module;
const D = M.default || M;
export { D as default }
export const member1 = M.member1;
// ...others
`,
})
Load a file. Support nested module id and support return Promise
import fs from 'fs'
external({
'path/filename': () => fs.promise.readFile('path/filename', 'utf8'),
})
external(entries)
type entries = Record<string, string | ((id: string) => string | Promise<string>)>;
external({
vue: 'Vue',
// Be equivalent to
// vue: () => `const M = window['Vue']; export { M as default }`,
})
In fact, the plugin will intercept your module import and return the specified code snippet
Let's use external({ vue: 'Vue' })
as an example, this will got the below code
const M = window['Vue']; export { M as default }
FAQs
Out of the box, built in Vue, React, Antd, Element and others
The npm package vite-plugin-fast-external receives a total of 1 weekly downloads. As such, vite-plugin-fast-external popularity was classified as not popular.
We found that vite-plugin-fast-external demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.