mrkeyoor.com_
Wed 23 Sept 00:35 UTC
npmCLI & Toolingupdated 22 Sept 2026

@intlify/message-compiler review

@intlify/message-compiler 11.4.10 is the parser and code generator used for Vue I18n message strings. It understands named and numbered placeholders, pipe plurals, linked keys, modifiers, and literal interpolation. baseCompile() returns JavaScript function source plus an AST, while createParser() exposes the AST step by itself. Neither API selects a locale or formats the final message for an application. The current stable release was published with a core-base devtools fix and lists no compiler-specific change; Intlify versions these monorepo packages together.

Verdict

@intlify/message-compiler 11.4.8 installed in 2.4 seconds, occupied 1 MB across three packages, and produced a 5.9 KB gzipped browser bundle in our sandbox, making the low-level compiler cheap enough for Vue I18n tooling. Application teams should use vue-i18n or its unplugin because this API returns code or AST data and leaves the runtime helper contract to the caller.

We installed it

Lab card: what happened when we installed @intlify/message-compilerScreenshot of @intlify/message-compiler documentation
Install✓ · 2.4s3 packages on disk · 1 MB
ImportESM import works · require() works · CommonJS package with exports map
Browser5.9 KBgzipped (18.1 KB minified), bundled with esbuild
TypesTypeScript types bundled
Known vulns00 critical · 0 high · 0 moderate · 0 low (npm audit)

Answers from our run

Does @intlify/message-compiler install cleanly?

Yes. In a fresh container with an empty cache, npm install @intlify/message-compiler finished in 2 seconds, leaving 3 packages and 1 MB on disk. npm audit reported no known vulnerabilities.

How much does @intlify/message-compiler add to a browser bundle?

5.9 KB gzipped (18.1 KB minified) when the whole package is bundled for the browser with esbuild. Importing only part of it is usually smaller.

Does @intlify/message-compiler work with both ESM and CommonJS?

Yes. Both import '@intlify/message-compiler' and require('@intlify/message-compiler') worked in Node 22 in our run. The package is published as CommonJS with an exports map.

Does @intlify/message-compiler include TypeScript types?

Yes, type declarations ship inside the package, so no @types install is needed.

@intlify/message-compiler or @intlify/unplugin-vue-i18n: which should you use?

@intlify/unplugin-vue-i18n: Use it for Vue application builds that should precompile locale files through supported Vite or webpack integration. @intlify/message-compiler 11.4.8 installed in 2.4 seconds, occupied 1 MB across three packages, and produced a 5.9 KB gzipped browser bundle in our sandbox, making the low-level compiler cheap enough for Vue I18n tooling.

When should you not use @intlify/message-compiler?

Your Vue app only needs translations at runtime; vue-i18n and its official unplugin own locale fallback, formatting, and build integration

API stability3/5Version 11.4.10 still exports baseCompile, createParser, compiler node types, source-location helpers, and a fixed set of 16 public error codes. Those symbols are typed, but generated functions depend on a separate Intlify context and minified JIT nodes use compact internal properties. A published 12.0.0-alpha.4 line also changes packaging toward ESM-only, so consumers should pin matching Intlify versions and test the next major before upgrading.
Docs2/5The package README contains one descriptive sentence and no usage example. Its bundled declaration file documents mode, JIT, optimize, minify, location, sourceMap, filename, cache-key, and error callback options, while the main Vue I18n site explains the message grammar. A developer still has to read types and core runtime source to learn which helpers generated functions require or how compact JIT nodes are consumed.
Maintenance5/5Stable 11.4.10 was published on August 25, 2026, two days after 11.4.9 and one month after our measured 11.4.8. The repository was pushed the same day and has 90 open issues and PRs across the entire Vue I18n monorepo. Release notes identify concrete fixes, and the project maintains both stable 11.x and 12.0 alpha work; the rapid lockstep releases make version alignment important.
Ecosystem4/5The npm downloads endpoint recorded 3,847,906 downloads for the week ending August 24, 2026, and the Vue I18n repository has 2,712 stars. Official runtime and bundler packages consume the same grammar and AST contract. That reach is substantial inside Vue I18n, while ICU-oriented tools cannot directly reuse its pipe plurals, linked-message syntax, or generated helper calls.

Use it if

  • You are building a Vue I18n linter, editor, extractor, or precompiler that must accept the project's exact message grammar
  • Build-time tooling needs generated message-function source and optional Node-side source maps
  • Your compatible Intlify runtime consumes optimized JIT ASTs instead of dynamically generated functions
  • Syntax diagnostics need numeric error codes plus offsets, lines, columns, and compiler domains
Skip it if

Setup reality

Our clean install used @intlify/message-compiler 11.4.8 and completed in 2.4 seconds. It put three packages and 1 MB on disk. The package declared two direct dependencies, no peers, 440 KB unpacked, bundled TypeScript declarations, and an MIT license. npm audit found 0 known vulnerabilities. The registry now marks 11.4.10 as stable, so those measurements describe 11.4.8 rather than the two later lockstep releases.

No account, key, or configuration file is needed. Node 22 is required. Keep @intlify/message-compiler aligned with the rest of an Intlify stack because it pins @intlify/shared to the exact package version. baseCompile() emits source for a function that expects helpers such as normalize, interpolate, named, list, plural, and linked from an Intlify runtime context. Calling the generated function with an ordinary data object is insufficient.

The measured 11.4.8 package used CommonJS packaging with an exports map, and require() plus ESM import both worked in our sandbox. Its browser bundle measured 18.1 KB minified and 5.9 KB gzipped with an import-all esbuild entry. JIT mode returns an empty code string and an AST for a compatible runtime. Setting minify changes that AST's property representation, which can break home-grown consumers that expect descriptive keys.

Compilation is synchronous. By default, a syntax error throws with a numeric code and source location. Supplying onError collects the error and lets compilation continue, so discard the returned code and AST whenever the callback ran. Source maps need sourceMap: true, location data, a meaningful filename, and the Node build. Evaluate generated code only from trusted catalogs; application builds are safer when the official unplugin compiles messages ahead of time.

Patterns

Compile a named placeholder compile-named-message

import {baseCompile} from '@intlify/message-compiler';

const compiled = baseCompile('Hello, {name}!');
console.log(compiled.code);

baseCompile returns function source and an AST. The emitted function expects Intlify's named, interpolate, and normalize helpers.

Emit an arrow function generate-arrow-source

const {code} = baseCompile('Welcome, {name}', {
  mode: 'arrow',
  needIndent: false,
  breakLineCode: ';'
});

Arrow mode changes the generated source form. It does not replace the ctx argument or any runtime helpers.

Compile pipe-separated plural cases compile-plurals

const {code} = baseCompile(
  'no files | one file | {count} files'
);

The three cases use Vue I18n plural grammar. An Intlify plural helper chooses a case when the function runs.

Compile numbered values compile-list-placeholders

const result = baseCompile('Hello, {0}. Queue position: {1}.');
console.log(result.ast);

A numeric placeholder becomes a call to the list helper, while a name such as {count} uses the named helper.

Compile a linked locale key compile-linked-key

const simple = baseCompile('Read @:legal.terms');
const modified = baseCompile('Email @.lower:labels.support');

Compilation records the link and modifier. The runtime resolves the locale key and supplies the lower modifier.

Insert a literal at-sign or pipe escape-special-character

const email = baseCompile("Write to {'@'}example.test");
const separator = baseCompile("Use {'|'} as the separator");

Single-quoted literal interpolation prevents @ from starting a linked message and | from splitting plural cases.

Create an AST without code generation parse-message

import {createParser} from '@intlify/message-compiler';

const parser = createParser();
const ast = parser.parse('Hello, {name}!');
console.log(ast.body);

createParser returns Vue I18n compiler nodes with location data enabled unless location is set to false.

Collect syntax diagnostics collect-errors

const diagnostics = [];
const result = baseCompile('Hello, {', {
  onError(error) {
    diagnostics.push({code: error.code, domain: error.domain, location: error.location});
  }
});

if (diagnostics.length > 0) throw new Error(JSON.stringify(diagnostics));

Providing onError replaces the default throw. Treat any callback invocation as a failed catalog entry even if result exists.

Omit AST source ranges remove-locations

const {ast} = baseCompile('Hello, {name}!', {
  jit: true,
  location: false
});

Disabling locations removes line, column, offset, and source slices that editors and precise diagnostics rely on.

Build an optimized runtime AST create-jit-ast

const result = baseCompile('Hello, {name}!', {
  jit: true,
  optimize: true
});

console.assert(result.code === '');

JIT mode deliberately leaves code empty. A matching Intlify runtime interprets the returned AST.

Compact a JIT message tree minify-jit-ast

const {ast} = baseCompile('Hello, {name}!', {
  jit: true,
  optimize: true,
  minify: true
});

Minification rewrites descriptive node properties. Custom AST readers must support Intlify's compact representation before enabling it.

Attach a source map generate-source-map

const result = baseCompile('Hello, {name}!', {
  filename: 'locales/en.json',
  sourceMap: true,
  location: true
});

console.log(result.map);

Source-map output needs the Node build and location tracking. Use the catalog path as filename so mappings identify the source asset.

Alternatives

PackageRegistryPick it when
@intlify/unplugin-vue-i18nnpmUse it for Vue application builds that should precompile locale files through supported Vite or webpack integration
@messageformat/corenpmUse it when an application needs to compile ICU-style MessageFormat rather than Vue I18n grammar
@formatjs/icu-messageformat-parsernpmUse it when tooling needs the FormatJS ICU AST for extraction, validation, or editor features
intl-messageformatnpmUse it when runtime code must parse and format ICU messages with plural, select, date, and number rules

More cli & tooling guides

chalk · commander · typescript · esbuild · yargs · click · the whole shelf →

How this guide is made: grounded in the library's documentation, release notes, changelog, and issue history, on a fixed rubric — not a hands-on install of every release. The 50 most-downloaded entries are additionally install-verified in clean containers. Corrections: contact the desk.