const require_logger = require('../../../config/dist/esm/logger.cjs');
const require_prepareIntlayer = require('./chokidar/dist/esm/prepareIntlayer.cjs');
const require_watcher = require('./chokidar/dist/esm/watcher.cjs');

//#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) require_watcher.watch$1({ configuration: this.configuration });
		compiler.hooks.beforeCompile.tapPromise("IntlayerPlugin", async () => {
			if (!this.isWatching) try {
				await require_prepareIntlayer.prepareIntlayer(this.configuration);
				this.isWatching = true;
			} catch (error) {
				require_logger.logger(`Error in IntlayerPlugin: ${error}`, { level: "error" });
			}
		});
	}
};

//#endregion
exports.IntlayerPlugin = IntlayerPlugin;
//# sourceMappingURL=webpack-plugin.cjs.map