I am woking on a Next.js project using the pages router. In the browser console, all console.logs are coming from a file called "index.js", but when I inspect the file, the logs come from the line original.apply(this, args);
in a from a line that contains:
function replace(_logger, level) {
if (!_logger[level]) {
return () => {
};
}
return patch(_logger, level, (original) => {
return (...args) => {
original.apply(this, args);
if (inStack) {
return;
}
inStack
For refrence, this file begins with
import { patch } from '../../../utils.js';
import { ErrorStackParser } from './error-stack-parser.js';
import { stringify } from './stringify.js';
const defaultLogOptions = {
level: [
'assert',
'clear',
'count',
'countReset',
'debug',
'dir',
'dirxml',
'error',
'group',
'groupCollapsed',
'groupEnd',
'info',
'log',
'table',
'time',
'timeEnd',
'timeLog',
'trace',
'warn',
],
lengthThreshold: 1000,
logger: 'console',
};
function initLogObserver(cb, win, options) {
and has not been touched by me, nor have I seen it before. My depenencies are listed below:
"dependencies": {
"@apollo/client": "^3.7.14",
"@notionhq/client": "^2.2.3",
"@testing-library/user-event": "^14.4.3",
"@types/node": "18.14.2",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"cookie": "^0.5.0",
"eslint-config-next": "13.2.1",
"graphql": "^16.6.0",
"knex": "^2.4.2",
"next": "13.2.1",
"next-auth": "^4.22.1",
"next-connect": "^1.0.0",
"next-router-mock": "^0.9.3",
"next-test-api-route-handler": "^3.1.8",
"objection": "^3.0.1",
"react": "^18.2.0",
"react-cookie": "^4.1.1",
"react-dom": "18.2.0",
"react-dropdown": "^1.11.0",
"react-pdf": "^7.0.3",
"react-select": "^5.7.3",
"react-text-transition": "^3.0.2",
"reactjs-popup": "^2.0.5",
"remark-html": "^15.0.2",
"sharp": "^0.32.3",
"sqlite3": "^5.1.6",
"typescript": "4.9.5"
},
"devDependencies": {
"source-map-loader": "^1.0.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"autoprefixer": "^10.4.14",
"eslint": "^8.41.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.32.2",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-fetch-mock": "^3.0.3",
"next-connect": "^1.0.0",
"postcss": "^8.4.21",
"tailwindcss": "^3.2.7"
}
I tried fixing the source maps using eval-cheap-source-map in the webpack devtools, but the logging was still all from like 103 in the same file.
Additionally, if I inspect the source in the chrome devtools, there is a file called "console.log" that contains:
Could not load content for webpack://react-devtools-extensions/react-devtools-shared/src/backend/console.js (Fetch through target failed: Unsupported URL scheme; Fallback: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME)
Any and all advice relating to solutions, or just on how to approach debugging would be greatly appreciated!