Fail Rollup build on unresolved imports

Closes #42850

Signed-off-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
Jon Koops 2025-09-23 09:52:38 +02:00 committed by GitHub
parent 83cfd4a3e2
commit 0610c5bce8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,6 +21,15 @@ const plugins = [
const targetDir = "target/classes/theme/keycloak/common/resources/vendor";
/** @type{import("rollup").WarningHandlerWithDefault} */
function onwarn(warning, defaultHandler) {
if (warning.code === "UNRESOLVED_IMPORT") {
throw new Error(`Unresolved import: ${warning.exporter}`);
}
defaultHandler(warning);
}
export default defineConfig([
{
input: [
@ -32,6 +41,7 @@ export default defineConfig([
format: "es",
},
plugins,
onwarn,
},
{
input: "node_modules/react-dom/cjs/react-dom.production.min.js",
@ -41,6 +51,7 @@ export default defineConfig([
},
external: ["react"],
plugins,
onwarn,
},
{
input: "src/main/js/web-crypto-shim.js",
@ -49,5 +60,6 @@ export default defineConfig([
format: "es",
},
plugins,
onwarn,
},
]);