keycloak-scim/themes/scripts/rewrite-imports.js
Jon Koops 293333056f
Import React from import map (#32335)
Closes #24863

Signed-off-by: Jon Koops <jonkoops@gmail.com>
2024-08-22 10:41:28 +00:00

17 lines
483 B
JavaScript

import fs from "node:fs/promises";
import path from "node:path";
const targetDir = "target/classes/theme/keycloak/common/resources/vendor";
replaceContents(
path.join(targetDir, "react/react-jsx-runtime.production.min.js"),
'"./react.production.min.js"',
'"react"',
);
async function replaceContents(filePath, search, replace) {
const file = await fs.readFile(filePath, "utf8");
const newFile = file.replace(search, replace);
await fs.writeFile(filePath, newFile);
}