@afterpack/nuxt
v0.2.2
Published
Nuxt 3 module for AfterPack: obfuscate a Nuxt app's production JavaScript during the build
Downloads
989
Maintainers
Readme
@afterpack/nuxt
A Nuxt 3 module that obfuscates your production JavaScript, using the AfterPack JavaScript obfuscator.
Install
npm install --save-dev @afterpack/nuxtUsage
// 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 (anti-tamper) 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.
