Surpress react/jsx-runtime errors
This commit is contained in:
parent
b8bae51b32
commit
764e8f76f0
@ -49,6 +49,7 @@ export default async function genWebHTML({ component, pageProps, bundledMap, mod
|
||||
"react-dom": `https://esm.sh/react-dom@${_reactVersion}`,
|
||||
"react-dom/client": `https://esm.sh/react-dom@${_reactVersion}/client`,
|
||||
"react/jsx-runtime": `https://esm.sh/react@${_reactVersion}/jsx-runtime`,
|
||||
"react/jsx-dev-runtime": `https://esm.sh/react@${_reactVersion}/jsx-dev-runtime`,
|
||||
};
|
||||
// if (dev) {
|
||||
// browser_imports["react/jsx-dev-runtime"] =
|
||||
|
||||
@ -4,9 +4,17 @@ export default async function (params) {
|
||||
const { ClientWindowPagePropsName } = grabConstants();
|
||||
let script = "";
|
||||
script += `console.log(\`Development Environment\`);\n\n`;
|
||||
const errors_to_supress = [
|
||||
"hydrat",
|
||||
"react/jsx-dev-runtime",
|
||||
"react/jsx-runtime",
|
||||
];
|
||||
const supress_condition = errors_to_supress
|
||||
.map((e) => `args[0].includes("${e}")`)
|
||||
.join(" || ");
|
||||
script += `const _ce = console.error.bind(console);\n`;
|
||||
script += `console.error = (...args) => {\n`;
|
||||
script += ` if (typeof args[0] === "string" && args[0].includes("hydrat")) return;\n`;
|
||||
script += ` if (typeof args[0] === "string" && (${supress_condition})) return;\n`;
|
||||
script += ` _ce(...args);\n`;
|
||||
script += `};\n\n`;
|
||||
script += `function __bunext_show_error(message, source, stack) {\n`;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "@moduletrace/bunext",
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"version": "1.0.35",
|
||||
"version": "1.0.36",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
|
||||
@ -74,6 +74,7 @@ export default async function genWebHTML({
|
||||
"react-dom": `https://esm.sh/react-dom@${_reactVersion}`,
|
||||
"react-dom/client": `https://esm.sh/react-dom@${_reactVersion}/client`,
|
||||
"react/jsx-runtime": `https://esm.sh/react@${_reactVersion}/jsx-runtime`,
|
||||
"react/jsx-dev-runtime": `https://esm.sh/react@${_reactVersion}/jsx-dev-runtime`,
|
||||
};
|
||||
|
||||
// if (dev) {
|
||||
|
||||
@ -13,9 +13,19 @@ export default async function (params?: Params) {
|
||||
|
||||
script += `console.log(\`Development Environment\`);\n\n`;
|
||||
|
||||
const errors_to_supress = [
|
||||
"hydrat",
|
||||
"react/jsx-dev-runtime",
|
||||
"react/jsx-runtime",
|
||||
];
|
||||
|
||||
const supress_condition = errors_to_supress
|
||||
.map((e) => `args[0].includes("${e}")`)
|
||||
.join(" || ");
|
||||
|
||||
script += `const _ce = console.error.bind(console);\n`;
|
||||
script += `console.error = (...args) => {\n`;
|
||||
script += ` if (typeof args[0] === "string" && args[0].includes("hydrat")) return;\n`;
|
||||
script += ` if (typeof args[0] === "string" && (${supress_condition})) return;\n`;
|
||||
script += ` _ce(...args);\n`;
|
||||
script += `};\n\n`;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user