Suppress svelte runtime warnings
This commit is contained in:
parent
43eac99730
commit
b041e43e98
|
@ -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/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"),
|
||||
|
|
Loading…
Reference in New Issue