Vite plugin for javascript-obfuscator
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 |
以下内容由 AI 翻译,如有问题请 点此提交 issue 反馈
vite-plugin-javascript-obfuscator
一款适用于 javascript-obfuscator 的 Vite 插件
安装
安装此包:
- npm
npm install --save-dev vite-plugin-javascript-obfuscator - yarn
yarn add --dev vite-plugin-javascript-obfuscator - pnpm
pnpm i vite-plugin-javascript-obfuscator -D
使用方法
示例 1
vite.config.js
import obfuscatorPlugin from "vite-plugin-javascript-obfuscator";
export default defineConfig({
plugins: [
obfuscatorPlugin({
options: {
// your javascript-obfuscator options
debugProtection: true,
// ... [See more options](https://github.com/javascript-obfuscator/javascript-obfuscator)
},
}),
],
});
示例 2
vite.config.js
import obfuscatorPlugin from "vite-plugin-javascript-obfuscator";
export default defineConfig({
plugins: [
obfuscatorPlugin({
include: ["src/path/to/file.js", "path/anyjs/**/*.js", /foo.js$/],
exclude: [/node_modules/],
apply: "build",
debugger: true,
options: {
// your javascript-obfuscator options
debugProtection: true,
// ... [See more options](https://github.com/javascript-obfuscator/javascript-obfuscator)
},
}),
],
});
参数
| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
include |
Array|String|RegExp|Function |
[/\.(jsx?|tsx?|cjs|mjs)$/] |
配置此选项以包含文件 |
exclude |
Array|String|RegExp|Function |
[/node_modules/, /\.nuxt/] |
配置此选项以排除文件 |
options |
Object |
javascript-obfuscator 默认选项 | 查看更多选项 |
apply |
'serve' | 'build' |
同时用于 serve 和 build | 默认情况下,插件会在 serve 和 build 时都被调用。如果需要插件仅在 serve 或 build 时条件性地应用,可使用 apply 属性指定其仅在 vite build 或 vite serve 时被调用 |
debugger |
Boolean |
false |
用于调试,打印出匹配或排除文件的路径。 |