
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
vite-preprocess
Advanced tools
vite-preprocess-loader支持vue项目中使用条件编译功能.
条件编译支持:
@ifdef 变量名
code...
@endif
@ifndef 变量名
code...
@endif
<script setup lang="ts">
// @ifdef web
console.log('hello world!')
// @endif
</script>
<template>
<div class="wrapper">
<!-- @ifdef web -->
<h1>web</h1>
<!-- @endif -->
<!-- @ifndef web -->
<h1>not web</h1>
<!-- @endif -->
</div>
</template>
<style scoped>
.wrapper {
line-height: 1.5;
max-height: 100vh;
/* @ifdef web */
color: red;
/* @endif */
/* @ifdef h5 */
font-size: 100px;
font-weight: bold;
/* @endif */
}
</style>
npm install vite-preprocess
需要在项目运行的时候添加临时node的环境变量platform
vite.config.ts
import vitePreprocess from 'vite-preprocess'
export default defineConfig({
plugins: [vitePreprocess(), vue()],
// esbuild: false, // esbuild默认过滤注释内容
esbuild: {
legalComments: 'none', // * 一定要设置'legalComments: none'或者 'esbuild: false' ,不用esbuild处理注释内容.
}
})
package.json
"scripts": {
"serve": "cross-env platform=h5 vite"
}
@ifdef 变量 /@endif 包括定义其中的代码块
@ifndef 变量 /@endif 不包括其中定义的代码块
FAQs
vite条件编译工具
We found that vite-preprocess 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.