UNPKG

lynx-intlayer

Version:

A Lynx plugin for seamless internationalization (i18n) and localization (l10n) of your mobile app.

44 lines (42 loc) 1.5 kB
let _intlayer_chokidar = require("@intlayer/chokidar"); let _intlayer_config = require("@intlayer/config"); //#region src/plugin/pluginIntlayerLynx.ts /** * 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 * }) */ const pluginIntlayerLynx = () => { return { name: "plugin-intlayer-lynx", async setup(api) { const configuration = (0, _intlayer_config.getConfiguration)(); await (0, _intlayer_chokidar.prepareIntlayer)(configuration); if (configuration.content.watch) (0, _intlayer_chokidar.watch)({ configuration }); api.modifyRsbuildConfig(async (config, { mergeRsbuildConfig }) => { return mergeRsbuildConfig(config, { resolve: { alias: { ...(0, _intlayer_config.getAlias)({ configuration }), react: (0, _intlayer_config.getProjectRequire)().resolve("@lynx-js/react") } } }); }); } }; }; //#endregion exports.pluginIntlayerLynx = pluginIntlayerLynx; //# sourceMappingURL=pluginIntlayerLynx.cjs.map