intlayer-bundle-optimization
Skill863 starsChanged 13 days agoApache-2.0View on GitHub
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`.
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- aymericzip/intlayer-skillsedited, first seen Sep 30, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- aymericzip/intlayer-skills★ 571% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository47 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- .cursor/rules/commit-message-guidelines.mdCursor rule
- intlayer-angularSkill
- intlayer-astroSkill
- intlayer-backendSkill
- intlayer-cliSkill
- intlayer-compatSkill
- intlayer-compilerSkill
- intlayer-configSkill
- intlayer-contentSkill
- intlayer-dev-toolsSkill
- intlayer-litSkill
- intlayer-markdownSkill
- intlayer-next-jsSkill
- intlayer-preactSkill
- intlayer-reactSkill
- intlayer-remixSkill
- intlayer-remote-contentSkill
- intlayer-solidSkill
- intlayer-svelteSkill
- intlayer-usageSkill
- intlayer-vanillaSkill
- intlayer-vueSkill
- intlayer-angularSkill
- intlayer-astroSkill
- intlayer-backendSkill
- intlayer-bundle-optimizationSkill
- intlayer-cliSkill
- intlayer-compatSkill
- intlayer-compilerSkill
- intlayer-configSkill
- intlayer-contentSkill
- intlayer-dev-toolsSkill
- intlayer-litSkill
- intlayer-markdownSkill
- intlayer-next-jsSkill
- intlayer-preactSkill
- intlayer-reactSkill
- intlayer-remixSkill
- intlayer-remote-contentSkill
- intlayer-solidSkill
- intlayer-svelteSkill
- intlayer-usageSkill
- intlayer-vanillaSkill
- intlayer-vueSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 106
Use your bundler's analyzer (rollup-plugin-visualizer, @next/bundle-analyzer, webpack-bundle-analyzer) to spot heavy dictionaries.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Intlayer Bundle Optimization
Doc
Configuration
import type { IntlayerConfig } from "intlayer";
const config: IntlayerConfig = {
dictionary: {
importMode: "dynamic", // 'static' (default) | 'dynamic' | 'fetch'
},
build: {
optimize: undefined, // auto: enabled in production builds only
purge: true, // drop fields never read in source code
minify: true, // rename field keys to short aliases (title → a)
},
};
export default config;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.
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
// ✅ Destructure or use dot access
const { title, description } = useIntlayer("post");Use select() instead of dynamic keys
// ❌ Opaque field: 'statuses' is kept whole, keys not minified
const { statuses } = useIntlayer("post");
<p>{statuses[post.status]}</p>;
// ✅ post.content.ts: publishStatus: select({ draft: "…", published: "…" })
const { publishStatus } = useIntlayer("post");
<p>{publishStatus(post.status)}</p>;Same for numbers (enu()), booleans (cond()) and genders (gender()).
Call useIntlayer in each component
// ❌ Passing content as a prop: the whole dictionary is kept
const Post = () => {
const content = useIntlayer("post");
return <PostFooter content={content} />;
};
// ✅ Each component reads its own fields; the dictionary is loaded once
const PostFooter = () => {
const { footer } = useIntlayer("post");
return <footer>{footer}</footer>;
};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:
loader: async ({ params }) => ({
content: await getIntlayerAsync("admin-metadata", params.locale),
}),
head: ({ loaderData }) => ({
meta: [{ title: loaderData?.content.title }],
}),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.
Scan Your Bundle
Use your bundler's analyzer (rollup-plugin-visualizer, @next/bundle-analyzer, webpack-bundle-analyzer) to spot heavy dictionaries. Setup per bundler: Bundle Optimization.
References
- Bundle Optimization
- Select
- Configuration
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

