Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
vite-plugin-fast-external
Advanced tools
Readme
English | 简体中文
🚀 High performance, without lexical transform
📦 Out of the box, built in Vue, React, Antd, Element and others
🌱 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_v17,
react_v18,
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
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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.