A minimal task-list app that gets protected automatically at build time.
cd examples/react-vite
npm install # html-guard is linked from the repo root via file:../..
npm run dev # normal development — protection is build-only
npm run build # vite build + HTML-Guard runs on dist/
npm run preview # serve the protected buildAfter npm run build check dist/:
dist/assets/*.js— string pool + minification, no sourcemap refsdist/assets/*.map— deleteddist/index.html— comments stripped,integrity="sha384-…"added- the app behaves exactly like the dev build
// vite.config.js
import htmlGuard from 'html-guard/plugins/vite';
export default {
plugins: [
react(),
htmlGuard({
js: { strings: true, minify: true },
html: { integrity: true, watermark: true },
files: { deleteMaps: true }
})
]
};Prefer a manual pipeline instead of the plugin?
npm run build && npx html-guard protect dist --react- CRA —
react-scripts build && npx html-guard protect build --react - Next.js static export —
next build && next export && npx html-guard protect out --react - Any static output — point
protectat the folder withindex.html