webpack-typescript-obfuscator weekly downloads statistics
By jerry_me · npm · Webpack plugins
Webpack plugin that obfuscates TypeScript class names, class members and local bindings through ts-loader
webpack-typescript-obfuscator has 108 recorded weekly downloads on npm, a change of -20.0% over the past 7 days, ranking #2613 of 3,247 tracked listings.
About webpack-typescript-obfuscator
webpack-typescript-obfuscator
Webpack 5 plugin that obfuscates TypeScript class names, class members, and
local variable bindings through
ts-loader.
Unlike name-based minifiers, renames are resolved per class, so two unrelated
classes that both define getName() can receive different generated names
without affecting each other.
Install
npm install --save-dev webpack-typescript-obfuscator ts-loader typescript webpack
Usage
The plugin works by injecting getCustomTransformers into an existing
ts-loader rule. It uses the real TypeScript Program created by
ts-loader, so no extra loader, ts-patch, or ttypescript is required.
// webpack.config.cjs
const path = require("node:path");
const TypeScriptObfuscatorPlugin =
require("webpack-typescript-obfuscator").default;
module.exports = {
module: {
rules: [
{
test: /\.[cm]?tsx?$/,
exclude: /node_modules/,
use: [{ loader: "ts-loader" }],
},
],
},
plugins: [
new TypeScriptObfuscatorPlugin({
renameStringLiterals: true,
// Shared across independently built packages so the same
// class/member always receives the same generated name.
identifierNamesCacheFilepath: path.resolve(
__dirname,
"typescript-obfuscator-cache.json",
),
projectRoot: __dirname,
}),
],
};
ESM configuration files work the same way:
import TypeScriptObfuscatorPlugin from "webpack-typescript-obfuscator";
The visible decorator
Import the no-op visible decorator from the ./visible subpath in application
code:
import { visible } from "webpack-typescript-obfuscator/visible";
class UserService {
@visible()
getName(): string {
return "alice";
}
// Renamed by the obfuscator.
internalLookup(): string {
return "a";
}
}
The subpath is deliberately separate from the plugin entry: it has no
dependencies on typescript, webpack, or Node built-ins, so importing it in
browser code does not pull the plugin into the application bundle. Both
@visible() and @visible are supported. The decorator name must match the
visibleDecorator option (default: visible).
Rules
visible is an empty decorator used only as a marker while obfuscating. It is
removed from the emitted code.
| Usage | Effect |
|---|---|
@visible() on a member | Keeps that member's original name. Applies to methods, fields, accessors, and static members. |
/** @visible */ on an interface member | Equivalent to the member-level marker. Use it when an interface member cannot carry a decorator. Implementations, subclasses, and interface call sites keep the original name together. |
@visible() on a class | Keeps only the class name. Its members are still renamed unless each one is marked. |
| Override group | A member overridden across a base class and a derived class forms one group. Marking any declaration in the group keeps the original name for the whole group, so polymorphic calls cannot land on the wrong implementation. |
| Inherited, not overridden | The member still belongs to the base declaration; only a marker on that member itself decides. A class-level marker on the subclass does not affect inherited members. |
| Variables / parameters / functions | No decorator semantics. They are renamed by default; use reservedNames to keep them. |
| Constructor parameter properties | Treated as members. Only decorating the constructor parameter with @visible() keeps its name. |
| Class expressions | Both named and anonymous class expressions take part in member renaming and override groups, just like class declarations. |
Additional notes:
-
A class-level marker keeps the class name but not its members:
@visible() // keeps "UserService" class UserService { internalLookup(): string { return "a"; // renamed } @visible() // keeps "getName" getName(): string { return "alice"; } } -
Marking one declaration keeps the whole override group:
class BaseRepository { @visible() save(item: string) {} } class UserRepository extends BaseRepository { save(item: string) {} // still "save": same override group } -
reservedNamesapplies to class names and non-member bindings only. For methods, fields, and accessors, only@visible()preserves the name. -
Literal member references are rewritten to match renamed members, regardless of the legacy
renameStringLiteralsoption. -
Unresolvable reflection and dynamic keys such as
obj[key]cannot be rewritten reliably. Mark externally accessed members with@visible()or avoid dynamic access.
File-level filtering
Large projects usually need to obfuscate only part of the tree. Configure paths in bulk, then override individual files with a header directive:
new TypeScriptObfuscatorPlugin({
projectRoot: __dirname,
include: ["src/core/**", "src/engine/**"], // obfuscate only these
exclude: ["src/legacy/**", "src/generated/**"], // never obfuscate these
})
/// <ts-obfuscate /> // skip this file (no argument means off)
/// <ts-obfuscate off /> // same, explicit form
/// <ts-obfuscate on /> // force obfuscation (overrides exclude)
Rules:…
Description from the npm listing.
- webpack
- webpack-plugin
- typescript
- ts-loader
- obfuscator
- obfuscation
- class
- rename
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (142)Similar npm Webpack plugins plugins
All 20 webpack-typescript-obfuscator alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/webpack-typescript-obfuscator. First seen Nov 11, 2026; last successful collection Dec 6, 2026. See the methodology.