import { prepareIntlayer } from "./chokidar/dist/esm/prepareIntlayer.mjs";
import { watch$1 } from "./chokidar/dist/esm/watcher.mjs";
import { logger } from "@intlayer/config";

//#region ../@intlayer/webpack/dist/esm/webpack-plugin.mjs
var IntlayerPlugin = class {
	isWatching = false;
	configuration;
	constructor(configuration) {
		this.configuration = configuration;
	}
	async apply(compiler) {
		if (this.configuration.content.watch) watch$1({ 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" });
			}
		});
	}
};

//#endregion
export { IntlayerPlugin };
//# sourceMappingURL=webpack-plugin.mjs.map