Skip to main content
Glama
webpack-plugin.ts1.05 kB
import { prepareIntlayer, watch } from '@intlayer/chokidar'; import { logger } from '@intlayer/config'; import type { IntlayerConfig } from '@intlayer/types'; import type { Compiler } from 'webpack'; // Watch mode or on time build export class IntlayerPlugin { private isWatching = false; // Flag to ensure we only start the watcher after the first build private configuration; constructor(configuration: IntlayerConfig) { this.configuration = configuration; } async apply(compiler: Compiler): Promise<void> { if (this.configuration.content.watch) { // Start watching (assuming watch is also async) watch({ configuration: this.configuration }); } compiler.hooks.beforeCompile.tapPromise('IntlayerPlugin', async () => { if (!this.isWatching) { try { await prepareIntlayer(this.configuration); this.isWatching = true; } catch (error) { logger(`Error in IntlayerPlugin: ${error}`, { level: 'error', }); } } }); } }

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