English | 中文文档
This project removes console.* calls from the published library build with a two-layer strategy.
- Build-time cleanup:
scripts/build-production.js - Runtime fallback:
projects/puzzle/src/console-override.ts - Auto bootstrap from:
projects/puzzle/src/public-api.ts
- Run production build (
ng build puzzle --configuration production). - Scan generated
.js/.mjsfiles. - Remove
console.*(...)calls. - Write cleaned files back to
dist.
- Detect prod mode using Angular runtime flags.
- Replace console methods with noop functions.
- Execute automatically through library entry import.
console.log,warn,error,info,debug,tracetable,group*,time*,count,assert,clear,dir*profile*andtimeStampwhen present
npm run build
grep -n "console" dist/puzzle/fesm2022/zhongmiao-ngx-puzzle.mjs- Dev mode is unaffected.
- If production logging is required, use a dedicated logger instead of
console.