Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
vite-plugin-bundle-obfuscator
Advanced tools
JavaScript obfuscator
plugin for Vite
environments
Changelog · Report Bug · Request Feature
English | 中文
JavaScript obfuscation
in Vite
projects.node_modules
.node_modules
split chunk.stringArray
is true
.
__vite__mapDeps
array)."build": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build"
, where max-old-space-size
is set according
to the configuration.node_modules
split chunk, please place the accurate package name at the front. For
example: ["vue-router", "vue"], "vue" can match both "vue" and "vue-router" at the same time.✦ Vite - Vanilla ✦ Vite - Vue ✦ Vite - React ✦ Vite - PReact ✦ Vite - lit ✦ Vite - Svelte ✦ Vite - Solid ✦ Vite - Qwik ✦ ...
# Using npm
npm install vite-plugin-bundle-obfuscator -D
# Using pnpm
pnpm add vite-plugin-bundle-obfuscator -D
# Using yarn
yarn add vite-plugin-bundle-obfuscator -D
vite.config.js
Example:
import vitePluginBundleObfuscator from 'vite-plugin-bundle-obfuscator';
// All configurations
const allObfuscatorConfig = {
excludes: [],
enable: true,
log: true,
autoExcludeNodeModules: true,
// autoExcludeNodeModules: { enable: true, manualChunks: ['vue'] }
threadPool: true,
// threadPool: { enable: true, size: 4 }
options: {
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 1,
deadCodeInjection: false,
debugProtection: false,
debugProtectionInterval: 0,
disableConsoleOutput: false,
identifierNamesGenerator: 'hexadecimal',
log: false,
numbersToExpressions: false,
renameGlobals: false,
selfDefending: true,
simplify: true,
splitStrings: false,
stringArray: false,
stringArrayCallsTransform: false,
stringArrayCallsTransformThreshold: 0.5,
stringArrayEncoding: [],
stringArrayIndexShift: true,
stringArrayRotate: true,
stringArrayShuffle: true,
stringArrayWrappersCount: 1,
stringArrayWrappersChainedCalls: true,
stringArrayWrappersParametersMaxCount: 2,
stringArrayWrappersType: 'variable',
stringArrayThreshold: 0.75,
unicodeEscapeSequence: false,
}
};
export default {
plugins: [
vitePluginBundleObfuscator(allObfuscatorConfig)
]
};
// Simplified configurations
const minimizeObfuscatorConfig = {
autoExcludeNodeModules: true,
// autoExcludeNodeModules: { enable: true, manualChunks: ['vue'] }
threadPool: true,
// threadPool: { enable: true, size: 4 }
};
export default {
plugins: [
vitePluginBundleObfuscator(minimizeObfuscatorConfig)
]
};
// Default configurations
export default {
plugins: [
vitePluginBundleObfuscator()
]
};
With 7000+ modules and 400+ bundles on a 4C 8G machine:
Property Name | Description | Type | Default | Version |
---|---|---|---|---|
threadPool | Configuration for the thread pool. | boolean | ({ enable: true; size: number } | { enable: false }) | false | v1.2.0 |
apply | Apply the plugin only for serve or build, or on certain conditions. | 'serve' | 'build' | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | build | v1.1.0 |
autoExcludeNodeModules | Enable auto exclude node_modules. | boolean | ({ enable: true; manualChunks: string[] } | { enable: false }) | false | v1.0.9 (originally boolean, extended to current type in v1.3.0) |
log | Show or hide log output. | boolean | true | v1.0.4 |
enable | Enable or disable the obfuscator. | boolean | true | v1.0.1 |
excludes | Bundle names to be excluded. Starting from v1.0.8, RegExp is supported. | (RegExp | string)[] | [] | v1.0.0 |
options | Options for the JavaScript obfuscator. | ObfuscatorOptions | defaultObfuscatorConfig | v1.0.0 |
MIT License Copyright (c) 2024-present, Zoffy
v1.3.1 - 19 November 2024
FAQs
JavaScript obfuscator plugin for Vite environments
The npm package vite-plugin-bundle-obfuscator receives a total of 738 weekly downloads. As such, vite-plugin-bundle-obfuscator popularity was classified as not popular.
We found that vite-plugin-bundle-obfuscator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.