Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

676 B
Raw Blame
// Clean the first output normally, then retain assets used by already-open windows.
class PreserveWatchAssetsPlugin {
    apply(compiler) {
        if (compiler.options.mode === "production") return;
        let emitted = false;
        compiler.hooks.thisCompilation.tap("PreserveWatchAssetsPlugin", compilation => {
            compiler.webpack.CleanPlugin.getCompilationHooks(compilation).keep.tap(
                "PreserveWatchAssetsPlugin", () => emitted ? true : undefined,
            );
        });
        compiler.hooks.afterEmit.tap("PreserveWatchAssetsPlugin", () => {
            emitted = true;
        });
    }
}

module.exports = PreserveWatchAssetsPlugin;