
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
vite-plugin-isdev
Advanced tools
如果你有一些代码只想在开发模式使用,在生产环境想去掉你可以使用此插件
npm i vite-plugin-isdev
该插件支持 vue ts tsx 文件 该插件接受两个参数
export interface Options{
prefix?:string, //条件注释前缀 默认dev
debugger?:boolean, //是否开启调试模式
}
vite.config.ts
import comments from 'vite-plugin-isdev'
plugins: [comments({
prefix:"xm", //自定义前缀 默认dev
debugger:false//是否开启调试模式
})],
条件注释语法
template 中使用 <!--#if-dev--> <!--#end-dev-->
script ts tsx css 使用 //#if-dev //#end-dev
<template>
<div>
<div>扰乱</div>
<!--#if-dev-->
<div>dev1</div>
<div>dev2</div>
<!--#end-dev-->
</div>
<h2>
<!--#if-dev-->
<div>dev</div>
<!--#end-dev-->
</h2>
<xxxx></xxxx>
</template>
<script lang="ts" setup>
import random from "random-words"
import xxxx from './App'
console.log(123)
const a = random(5)
//#if-dev
var b = "__dev__"
//#end-dev
console.log('动次打次')
//#if-dev
console.log(a)
//#end-dev
</script>
<style lang="less">
//#if-dev
body{
background: red;
}
//#end-dev
</style>
<style scoped>
div{
color:white
}
</style>
编译之后 被条件注释包裹的代码将会在生产环境删除
<template>
<div>
<div>扰乱</div>
</div>
<h2>
</h2>
<xxxx></xxxx>
</template>
<script setup lang='ts' >
import random from "random-words"
import xxxx from './App'
console.log(123)
const a = random(5)
console.log('动次打次')
</script>
<style lang='less'>
</style>
<style scoped >
div{
color:white
}
</style>
FAQs
We found that vite-plugin-isdev 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.