@afterpack/nuxt
@afterpack/nuxt
A Nuxt 3 module that obfuscates your production JavaScript, using the AfterPack JavaScript obfuscator.
Install
npm install --save-dev @afterpack/nuxt
Usage
// nuxt.config.ts
export default defineNuxtConfig({
modules: ["@afterpack/nuxt"],
afterpack: {
seed: "git",
},
});
The module adds AfterPack to Nuxt's Vite build, so every JavaScript chunk is obfuscated before it
is written. That covers the client bundle of a server-rendered app and the prerendered output of
nuxt generate in .output/public/_nuxt/. A failed run fails the build.
Options under the afterpack key are the same as
@afterpack/vite.
The options you are most likely to set are preset, complexity,
seed, identifiers.reserved for names that must stay as they are,
paths.exclude for files to leave alone, and build.autorun to
turn AfterPack off. Every other option is in the configuration
reference. Options can also live in afterpack.json or in
AFTERPACK_* environment variables.
Nuxt 2 builds with webpack. Use @afterpack/webpack
there.
Pro
Without a key, AfterPack runs on your machine with the full pipeline at any preset. Set
AFTERPACK_KEY in your environment and the same module
builds in AfterPack's cloud instead, which adds per-region
directives and two hardening transforms you can turn
on: self-integrity, which detects edits to its own check table only, not edits
elsewhere in your code, and comparison hardening. Keep the key out of nuxt.config.ts. See
AfterPack Pro.
Links
- Nuxt setup guide
- Presets and protection levels
- How AfterPack compares to other obfuscators
- Stopping userscripts and extensions from patching your app
License
Apache-2.0. The engine it runs, @afterpack/core, has its own
license.
Feedback
Questions, suggestions and bug reports: afterpack.dev/contact. You can also file a bug on GitHub Issues.
Related Packages
Vue 3 plugin for AfterPack: obfuscate a Vue app's production JavaScript during t...
Nuxt module for automatic Vite dev server configuration with tunnels (Cloudflare...
Keep long Tailwind utility classes out of your Vue templates with a typed YAML b...
Version History
| Version | Released | License |
|---|---|---|
| 0.2.7 | Apache-2.0 | |
| 0.2.6 | Apache-2.0 | |
| 0.2.5 | Apache-2.0 | |
| 0.2.4 | Apache-2.0 | |
| 0.2.3 | Apache-2.0 | |
| 0.2.2 | Apache-2.0 | |
| 0.2.1 | Apache-2.0 | |
| 0.2.0 | Apache-2.0 | |
| 0.1.0 | Apache-2.0 |
Pre-releases (3)
| Version | Released | License |
|---|---|---|
| 0.2.0-rc.20260930T1421 | Apache-2.0 | |
| 0.1.0-rc.20260925T1355 | Apache-2.0 | |
| 0.1.0-rc.20260925T1347 | Apache-2.0 |