
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
vite-plugin-auto-include
Advanced tools
A tool that can auto add babel-plugin-import's result to vite's Pre-bundling dependencies.
A tool that can auto add babel-plugin-import's result to vite's Pre-bundling dependencies.
When we use babel-plugin-import or the same tool to minimize our bandle,the vite(server mode) always reload page because of it find new dependencies. Use this tool,it can auto add to vite's Pre-bundling dependencies.
yarn add vite-plugin-auto-include --dev or npm install vite-plugin-auto-include -D
//vite.config.ts or vite.config.js
import autoInclude from 'vite-plugin-auto-include';
export default defineConfig({
...
plugins: [
autoInclude({
libraryName: 'antd',
libraryDirectory: 'es',
style: true
}),
...
],
...
})
//options can be AutoIncludeOpt or AutoIncludeOpt[]
interface AutoIncludeOpt {
libraryName: string;
/** default es */
libraryDirectory?: string;
/** default style */
styleLibraryDirectory?: string;
/**
* - true => index.js;
* - string => string.js; for example: if set css , will return css.js;
* - function => path; notice : can't return .less or .scss or .stylus;
*/
style?: true | string | ((name: string, path?: string) => string | null | undefined);
/** ignore some conponet's directory */
ignoreDirs?: string[];
}
For Example:
autoInclude({
libraryName: 'antd',
libraryDirectory: 'es',
style: (name) => {
if (name === '_util' || name === 'locale'|| name==='style') return null;
return `antd/es/${name}/style`;//real fiel:`antd/es/${name}/style/index.js`
},
}),
//or
autoInclude([
{
libraryName: 'antd',
libraryDirectory: 'es',
ignoreDirs: ['_util', 'locale', 'style'],
style: true
},
{
libraryName: 'antd-mobile',
libraryDirectory: 'es',
style: 'css'
}
]),
FAQs
A tool that can auto add babel-plugin-import's result to vite's Pre-bundling dependencies.
We found that vite-plugin-auto-include 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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.