Suppress svelte runtime warnings
This commit is contained in:
parent
14b23cffee
commit
5e2ba8c45f
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,11 +7,19 @@ import "@spectrum-css/vars/dist/spectrum-light.css"
|
||||||
import "@spectrum-css/vars/dist/spectrum-lightest.css"
|
import "@spectrum-css/vars/dist/spectrum-lightest.css"
|
||||||
import "@spectrum-css/page/dist/index-vars.css"
|
import "@spectrum-css/page/dist/index-vars.css"
|
||||||
import "./global.css"
|
import "./global.css"
|
||||||
|
import { suppressWarnings } from "./helpers/warnings"
|
||||||
import loadSpectrumIcons from "@budibase/bbui/spectrum-icons-vite.js"
|
import loadSpectrumIcons from "@budibase/bbui/spectrum-icons-vite.js"
|
||||||
|
import App from "./App.svelte"
|
||||||
|
|
||||||
|
// Init spectrum icons
|
||||||
loadSpectrumIcons()
|
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({
|
export default new App({
|
||||||
target: document.getElementById("app"),
|
target: document.getElementById("app"),
|
||||||
|
|
Loading…
Reference in New Issue