From 0610c5bce8ea35c1c22c5e320f4e6fa85b706e05 Mon Sep 17 00:00:00 2001 From: Jon Koops Date: Tue, 23 Sep 2025 09:52:38 +0200 Subject: [PATCH] Fail Rollup build on unresolved imports Closes #42850 Signed-off-by: Jon Koops --- js/themes-vendor/rollup.config.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/themes-vendor/rollup.config.js b/js/themes-vendor/rollup.config.js index b4d98d01b0f..228bb2dd291 100644 --- a/js/themes-vendor/rollup.config.js +++ b/js/themes-vendor/rollup.config.js @@ -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, }, ]);