Skip to main content
Glama
pluginIntlayerLynx.ts1.71 kB
import { prepareIntlayer, watch } from '@intlayer/chokidar'; import { getAlias, getConfiguration, getProjectRequire, } from '@intlayer/config'; import type { RsbuildPlugin } from '@rsbuild/core'; /** * A Lynx plugin to integrate Intlayer into the Lynx build process. * * - Loads the Intlayer configuration and injects environment variables. * - If enabled, starts a file watcher for dictionary changes. * - On build, prepares the Intlayer configuration. * - Optionally checks for dictionary changes before compiling (hot reload). * * Usage in your lynx.config.ts: * * import { defineConfig } from '@lynx-js/rspeedy' * import { pluginIntlayerLynx } from '@intlayer/lynx-plugin' * * export default defineConfig({ * plugins: [ * pluginIntlayerLynx(), * ], * // ...other configuration * }) */ export const pluginIntlayerLynx = (): RsbuildPlugin => { return { name: 'plugin-intlayer-lynx', async setup(api) { // Load the Intlayer configuration and format env variables for Lynx. const configuration = getConfiguration(); await prepareIntlayer(configuration); // If file watching is enabled in Intlayer's config, start it. if (configuration.content.watch) { watch({ configuration }); } // Merge Intlayer-specific environment variables and alias configuration. api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig }) => { return mergeRsbuildConfig(config, { resolve: { alias: { ...getAlias({ configuration }), react: getProjectRequire().resolve('@lynx-js/react'), }, }, }); }); }, }; };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aymericzip/intlayer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server