When Tree Shaking Fails: Security Risks in Nuxt & Vue
summary
Tree shaking sometimes keeps unused code and can leak secrets when CommonJS patterns, default-exported objects, or side-effecting APIs prevent static analysis. The talk shows concrete failures (over 45,000 GitHub modules with export-aggregation), demonstrates a low-tech console.log probe to detect bundled secrets, and explains fixes: split files, add /pure or no side effects* annotations, and structural changes. Several PRs to Svelte Mini Pinia and VueUse are already merged and reduce leakage.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 3:54Tree shaking basics
- 6:20Pitfalls breaking tree shaking
- 11:43Side effects in code
- 15:56Security risks when tree shaking fails
- 18:50Detecting tree shaking failures
- 20:36Fixing tree shaking issues
- 22:21Real-world optimizations
- 25:12Summary
related talks
08mUnderstand the hard parts of Nuxt
12mLet's Vue Like It's 1999
47mNode.js Security: Breaking The Loop
24mStrangerDanger: Finding Security Vulnerabilities Before They Find You!
27mState of Node.js Security
22mDeep dive into Nuxt.js
29mA Node.js Security Roadmap
14mStranger Danger: Tracking Vulnerabilities in Your Third Party Code
