
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
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.
vite-plugin-virtual-alias
Advanced tools
[](https://www.npmjs.com/package/vite-plugin-virtual-alias) [](https://github.c
English | 中文
A lightweight Vite plugin that provides powerful virtual alias functionality, allowing you to map custom virtual paths to actual files in your project during the build process.
Install with your favorite package manager:
# Using npm
npm install -D vite-plugin-virtual-alias
# Using yarn
yarn add -D vite-plugin-virtual-alias
# Using pnpm
pnpm add -D vite-plugin-virtual-alias
Add the plugin to your Vite configuration:
// vite.config.ts
import { defineConfig } from 'vite'
import { virtualAlias } from 'vite-plugin-virtual-alias'
export default defineConfig({
plugins: [
virtualAlias({
mappings: [
{
// Virtual path
proto: 'virtual:config.ts',
// Mapped path
resolve: 'path/to/your/custom/config.alias.ts',
// or
// source: 'path/to/your/custom/config.alias.ts',
},
],
}),
],
})
After configuration, you can use the virtual alias in your code:
// Import using virtual alias
import config from 'virtual:config.ts'
console.log(config) // Will be resolved to path/to/your/custom/config.alias.ts
resolveId hook for path mapping, which affects the built file namesload hook to directly return file content, keeping the original file namesContributions are welcome! Please feel free to submit issues and pull requests. For major changes, please open an issue first to discuss what you would like to change.
FAQs
[](https://www.npmjs.com/package/vite-plugin-virtual-alias) [](https://github.c
The npm package vite-plugin-virtual-alias receives a total of 0 weekly downloads. As such, vite-plugin-virtual-alias popularity was classified as not popular.
We found that vite-plugin-virtual-alias demonstrated a healthy version release cadence and project activity because the last version was released less than 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
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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.