Surpress react/jsx-runtime errors: Bugfix #3
This commit is contained in:
parent
ee07163ba5
commit
572f739b5c
@ -12,9 +12,6 @@ export default async function (params) {
|
||||
const supress_condition = errors_to_supress
|
||||
.map((e) => `args[0].includes("${e}")`)
|
||||
.join(" || ");
|
||||
const runtime_supress_condition = errors_to_supress
|
||||
.map((e) => `message.includes("${e}")`)
|
||||
.join(" || ");
|
||||
script += `const _ce = console.error.bind(console);\n`;
|
||||
script += `console.error = (...args) => {\n`;
|
||||
script += ` if (typeof args[0] === "string" && (${supress_condition})) return;\n`;
|
||||
@ -30,7 +27,8 @@ export default async function (params) {
|
||||
script += ` document.body.appendChild(overlay);\n`;
|
||||
script += `}\n\n`;
|
||||
script += `function __bunext_should_suppress_runtime_error(message) {\n`;
|
||||
script += ` return typeof message === "string" && (${runtime_supress_condition});\n`;
|
||||
script += ` return false;\n`;
|
||||
// script += ` return typeof message === "string" && (message.includes('Dynamic require of "react/jsx-dev-runtime"') || message.includes("react/jsx-dev-runtime"));\n`;
|
||||
script += `}\n\n`;
|
||||
script += `window.addEventListener("error", (e) => {\n`;
|
||||
script += ` const message = String(e.message ?? "");\n`;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "@moduletrace/bunext",
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"version": "1.0.38",
|
||||
"version": "1.0.39",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
|
||||
@ -23,10 +23,6 @@ export default async function (params?: Params) {
|
||||
.map((e) => `args[0].includes("${e}")`)
|
||||
.join(" || ");
|
||||
|
||||
const runtime_supress_condition = errors_to_supress
|
||||
.map((e) => `message.includes("${e}")`)
|
||||
.join(" || ");
|
||||
|
||||
script += `const _ce = console.error.bind(console);\n`;
|
||||
script += `console.error = (...args) => {\n`;
|
||||
script += ` if (typeof args[0] === "string" && (${supress_condition})) return;\n`;
|
||||
@ -43,7 +39,8 @@ export default async function (params?: Params) {
|
||||
script += ` document.body.appendChild(overlay);\n`;
|
||||
script += `}\n\n`;
|
||||
script += `function __bunext_should_suppress_runtime_error(message) {\n`;
|
||||
script += ` return typeof message === "string" && (${runtime_supress_condition});\n`;
|
||||
script += ` return false;\n`;
|
||||
// script += ` return typeof message === "string" && (message.includes('Dynamic require of "react/jsx-dev-runtime"') || message.includes("react/jsx-dev-runtime"));\n`;
|
||||
script += `}\n\n`;
|
||||
script += `window.addEventListener("error", (e) => {\n`;
|
||||
script += ` const message = String(e.message ?? "");\n`;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user