diff --git a/packages/builder/src/helpers/warnings.js b/packages/builder/src/helpers/warnings.js new file mode 100644 index 0000000000..ad943a8578 --- /dev/null +++ b/packages/builder/src/helpers/warnings.js @@ -0,0 +1,16 @@ +export const suppressWarnings = warnings => { + if (!warnings?.length) { + return + } + const regex = new RegExp(warnings.map(x => `(${x})`).join("|"), "gi") + const warn = console.warn + console.warn = (...params) => { + const msg = params[0] + if (msg && typeof msg === "string") { + if (msg.match(regex)) { + return + } + } + warn(...params) + } +} diff --git a/packages/builder/src/main.js b/packages/builder/src/main.js index f0fd0af178..bc5ec4f009 100644 --- a/packages/builder/src/main.js +++ b/packages/builder/src/main.js @@ -7,11 +7,19 @@ import "@spectrum-css/vars/dist/spectrum-light.css" import "@spectrum-css/vars/dist/spectrum-lightest.css" import "@spectrum-css/page/dist/index-vars.css" import "./global.css" - +import { suppressWarnings } from "./helpers/warnings" import loadSpectrumIcons from "@budibase/bbui/spectrum-icons-vite.js" +import App from "./App.svelte" + +// Init spectrum icons loadSpectrumIcons() -import App from "./App.svelte" +// Suppress svelte runtime warnings +suppressWarnings([ + "was created with unknown prop", + "was created without expected prop", + "received an unexpected slot", +]) export default new App({ target: document.getElementById("app"),