mirror-cockpit-project-cockpit/pkg/lib/cockpit-remove-rhicons-plugin.js
Jelle van der Waa fdeaddeb8d lib: Use async I/O APIs in RemoveRHIconsPlugin
This function is async so use asynchronous I/O functions.
2026-09-15 20:54:10 +02:00

13 lines
430 B
JavaScript

// SPDX-License-Identifier: LGPL-2.1-or-later
import fs from 'node:fs';
export const cockpitRemoveRHIconsPlugin = () => ({
name: 'cockpitRemoveRHIconsPlugin',
setup(build) {
build.onLoad({ filter: /-icon\.js$/ }, async ({ path }) => {
const contents = await fs.promises.readFile(path, 'utf-8');
return { contents: contents.replace(/rhUiIcon: {.*}/g, "undefined") };
});
}
});