Webpack code splitting: ChunkLoadError – Loading chunk X failed, but the chunk exists

The chunk is reachable doesn’t mean the user’s browser can parse it. For example, if the user’s browser is old. But the chunk contains new syntax. Webpack loads the chunk by jsonp. It insert <script> tag into <head>. If the js chunk file is downloaded but cannot parsed. A ChunkLoadError will be throw. You can … Read more

console.log() called on object other than console

Editor’s Draft of Console API used to say: Logging APIs SHOULD all be callable functions allowing them to be passed as arguments to error handling callbacks, forEach methods, etc. This is no longer included in the current version of the specification. I thought that Chrome and Node.js changed it to work like in the specification, … Read more

How to print stack trace with reference to typescript source in Nest.js

For visibility purposes: adding the source-map-support NPM package allows for tracing typescript files in the stack trace. It can be added on the command line with node -r source-map-support/register fileToRun.js or programatically with import * as sourceMapSupport from ‘source-map-support’; sourceMapSupport.install(); OR import { install } from ‘source-map-support’; install(); OR with ES6 modules import ‘source-map-support/register’;

Access function location programmatically

The answer, for now, is no. The [[FunctionLocation]] property you see in Inspector is added in V8Debugger::internalProperties() in the debugger’s C++ code, which uses another C++ function V8Debugger::functionLocation() to gather information about the function. functionLocation() then uses a number of V8-specific C++ APIs such as v8::Function::GetScriptLineNumber() and GetScriptColumnNumber() to find out the exact information. All … Read more

How to create hyperlinks linked to javascript functions in Chrome’s console.log?

The Google Chrome console, like many other browser’s developer tools consoles, automatically parses any URL into a link to that exact page. This is the only way of obtaining such URLs, and, unfortunately, you cannot actually log “custom URLs”. This means that the following logs will be turned into a clickable link automatically: console.log(‘http://example.com’); console.log(‘www.example.com’); … Read more

How can remove console.log in the production build of a React application created using create-react-app?

I am using this approach to avoid ejecting react-scripts if (process.env.NODE_ENV === ‘production’) { console.log = () => {} console.error = () => {} console.debug = () => {} } index.js import React from ‘react’ import ReactDOM from ‘react-dom’ import App from ‘./App’ import ‘./styles/main.scss’ // replace console.* for disable log on production if (process.env.NODE_ENV … Read more