aymericzip/intlayer-skills/intlayer-bundle-optimization
Claude Code and agent skill by aymericzip/intlayer-skills
- community
Checking that the SKILL.md file is still in the repository.
Keeps Intlayer dictionaries small in production bundles (purge, minify, import modes). Use when the user asks to "reduce bundle size", "optimize dictionaries", fix "cannot be purged or minified" / "Opaque field" build warnings, or configure `build.optimize`, `build.purge`, `build.minify` or `importMode`.
Install
npx vskill@latest install aymericzip/intlayer-skills/intlayer-bundle-optimizationSKILL.md
Intlayer Bundle Optimization
Configuration
purgeandminifydo nothing whenoptimizeisfalse.minifyskips key renaming whileeditor.enabledistrue, and forimportMode: 'fetch'dictionaries.importMode: 'dynamic'ships only the current locale's JSON; it can also be set per dictionary.
Dictionaries Follow Their Chunk
The build optimization rewrites each useIntlayer('key') / getIntlayer('key') into a direct import of that dictionary, then empties the global dictionary registry:
- A dictionary is bundled with the component that reads it, so a lazy-loaded route only ships its own content.
With importMode: 'dynamic', vite-intlayer adds two more build plugins (build only, not in dev):
intlayerChunk(build.chunkGrouping, defaulttrue) merges the per-dictionary, per-locale chunks by the code-split boundary that uses them (React.lazy, split route). Each boundary loads its content in one request per locale. Dictionaries used by several boundaries go to a shared chunk.intlayerPreload(build.dictionariesPreload, defaulttrue) starts the dictionary fetch when its chunk is loaded, instead of when the component renders, so navigation does not flash a loading state.
Keep dictionaries scoped to their component or page. A dictionary read from many routes ends up in a shared chunk.
Write Code the Analyzer Can Follow
Purge and minify rely on a static analysis of every useIntlayer / getIntlayer call. When a read cannot be followed, the build keeps the whole field or dictionary and warns:
Dictionary <key> cannot be purged or minified: the content object escapes.Dictionary <key> partially minified. Opaque field: '<path>': a field is read with a dynamic key.
Read fields by name
Use select() instead of dynamic keys
Same for numbers (enu()), booleans (cond()) and genders (gender()).
Call useIntlayer in each component
Don't let the content object escape
Spreading ({ ...content }), iterating (Object.entries(content)) or passing it to a helper (format(content)) keeps the whole dictionary.
Accepted Exceptions
Some framework APIs need the content as a value, for example a TanStack Start route that loads it in loader and reads it in head:
The analyzer cannot follow loaderData, so this dictionary stays whole and the warning is expected. Keep such dictionaries dedicated and small (e.g. a *-metadata dictionary holding only the page metadata) so the rest of the content is still optimized.
References
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/intlayer-bundle-optimization/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aymericzip/intlayer-skills/intlayer-bundle-optimization)