{"library":"rollup-plugin-messageformat","title":"rollup-plugin-messageformat","description":"Rollup plugin that lets you import JSON, YAML, and .properties files containing ICU MessageFormat messages, converting them into message functions compatible with @messageformat/react and @messageformat/runtime. Current stable version is 3.0.0, supporting Node >=14 and shipping TypeScript types. The plugin handles locale-aware file matching, key-path parsing for .properties, and tree-shaking by extracting only used messages. It requires @messageformat/runtime as a runtime peer dependency for generated code. Unlike manual message loading, it integrates directly into the Rollup build pipeline, enabling efficient code splitting and smaller bundles.","language":"javascript","status":"active","last_verified":"Mon Apr 27","install":{"commands":["npm install rollup-plugin-messageformat"],"cli":null},"imports":["import { messageformat } from 'rollup-plugin-messageformat'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// rollup.config.js\nimport { messageformat } from 'rollup-plugin-messageformat';\n\nexport default {\n  input: 'src/index.js',\n  output: { format: 'es', dir: 'dist' },\n  plugins: [\n    messageformat({\n      locales: ['en', 'fr'],\n      include: ['**/messages/**']\n    })\n  ]\n};\n\n// src/index.js\nimport frMessages from './messages/fr.yaml';\nimport enMessages from './messages/en.yaml';\n\nconst messages = { en: enMessages, fr: frMessages };\nconsole.log(messages.en.hello({ name: 'World' }));\nconsole.log(messages.fr.hello({ name: 'Monde' }));\n\n// messages/en.yaml\n// hello: \"Hello, {name}!\"\n// messages/fr.yaml\n// hello: \"Bonjour, {name}!\"","lang":"typescript","description":"Sets up Rollup with the messageformat plugin, imports YAML message files, and uses the generated message functions with locale data.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}