I can't seem to find my line numbers in TypeScript console logs

My breakpoints are not working in VSCode and I'm also missing TypeScript line numbers in the console. It seems like they might be connected somehow. I have already set sourceMaps=true in tsconfig.json.

Does anyone know how to restore line numbers in the console for my Angular application?

https://i.sstatic.net/ZrlFp.png

Answer №1

It seems that the issue you are experiencing may be linked to your configuration settings.

Here are the logs generated by a fresh Angular project on my system.

Logs after executing ng serve -c production:

main-MVCVS4N4.js:1 Test logging
polyfills-LZBJRJJE.js:1 Angular is running in development mode.

Logs after running ng serve (which defaults to development configuration):

app.component.ts:16 Test logging
core.mjs:29995 Angular is running in development mode.

If necessary, you can create new Angular projects to compare your logs and review your angular.json setup.


UPDATE
Ensure that source maps are enabled in Chrome as well. With Chrome DevTools open and selected, press F1 to access the settings page. Navigate to the Preferences tab and confirm that the Enable JavaScript source maps option is checked. Alternatively, you can click on the Restore defaults and reload button located at the lower right corner of the same tab.

I conducted a test using the exact version you provided (16.0.1) and obtained similar results. You should be able to observe the log message

Angular is running in development mode
.

If the issue persists, consider sharing the output from ng version, along with details of your Chrome version and the specific steps taken to set up and serve a new Angular application.

If you are utilizing the Angular CLI, the process should be straightforward:

ng new app --defaults
cd app
ng serve -o

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The error message is: "Cannot access property 'up' of an undefined object within the material UI library using theme.breakpoints."

I am encountering difficulties with the export of makeStyles. Below you can find my code and configuration: import SearchField from "../SearchField"; import { TextField, Select, useMediaQuery, Grid, Button, Box, Fade } from '@material-ui/core&ap ...

Tips for modifying the type definition of a third-party library in a Vue project built with Create-Vue

After updating the Cesium library in my Vue project, I encountered some errors. This is the code snippet: camera.setView({ destination, orientation: { heading, pitch } }) The error message reads: Type '{ heading: number; pitch: number; }' i ...

What causes the variation in typing behavior between specifying props directly on a component versus nesting them inside another prop?

Understanding the next component might be a bit tricky, so let's delve into it (Check playground): type Props<T> = { initValue: T, process: (value: T) => T } export const Input = <T,>({ initValue, process, }: Props<T>): ...

Using Angular ngx-bootstrap model without the need for ng-template

Looking to incorporate a bootstrap modal into my app, but I require the ability to customize the style of the modal myself. The example using ngx-bootstrap and ng-template doesn't allow for this level of customization. Are there any alternative soluti ...

Utilize openapi-generator-cli in C# to tailor the names of properties and types created for oneOf requestBodies and polymorphic properties

I am working with an API that involves complex DTOs with polymorphic properties and endpoints that accept polymorphic request bodies (oneOf). Here is an example of a C# complex type: Example c# complex type namespace Sample { public class ComplexTyp ...

Javascript - Implement validation pattern requiring a minimum of one character that is not a space

I am looking to create an input field with a validation pattern that does not allow spaces. While I found a solution that includes a pattern for alphanumeric characters and spaces, it does not account for special characters such as č, ć, ž, đ, š, and ...

What features does Vue.js lack compared to Angular 2?

What are some features or modules that Vue.js does not have, but Angular 2/4 does? I'm thinking about learning Vue.js and using it for my next project, but I want to be aware of any potential limitations. While I know about the impressive features of ...

Tips for resolving the error message "termsOfUse must be a boolean type, but the final value was: 'on'," using a combination of Ionic, React, Yup, and Resolvers

I need to develop a registration form with all fields mandatory using React Hook Form and Yup for validation. The issue I'm facing is related to two checkboxes that are required. Upon form submission, I encounter the following error message for the ch ...

Transferring information from child to parent class in TypeScript

I have a scenario where I have two classes (Model). Can I access properties defined in the child class from the parent class? Parent Class: class Model{ constructor() { //I need the table name here. which is defined in child. } publ ...

Generating custom error messages with specified format when utilizing routing-controllers

I'm currently working on a Node APP that utilizes the routing-controllers library. In the README file, there is a section titled Throw HTTP errors, which includes a self-explanatory example. However, I encountered an issue when attempting to replicat ...

The Angular application is configured with distinct locales for debugging and for running

In my application, there is a calendar feature that displays a string representation of a timestamp. When selecting a date from a date picker (using date-fns and angular-calendar), I make a POST request in my service. postWorkingSlot(workingSlot: NewWorkin ...

Implementing chance.js in an Angular 4.x Component's ngOnInit() Method

I just started using angular 4.x and I'm trying to load change.js in the ngOnInit() function. I've attempted a few things but nothing seems to be working. Here is the code snippet: This is the code I have so far: import { Component, OnInit, In ...

Navigating through different components within a single page

Each segment of my webpage is a distinct component, arranged consecutively while scrolling e.g.: <sectionA></sectionA> <sectionB></sectionB> <sectionC></sectionC> All the examples I've come across involve creating ...

Potential absence of value in this Vue 3 component's 'this' placement

I've been encountering an issue with using this.$refs within my Vue component. No matter where I place it - whether in methods, lambdas, or lifecycle hooks - I consistently receive errors indicating that 'this' may be undefined. As a newcome ...

Exploring Angular 2 Tabs: Navigating Through Child Components

Recently, I've been experimenting with trying to access the HTML elements within tabs components using an example from the Angular 2 docs. You can view the example here. Here is a snippet of my implementation: import {Component, ElementRef, Inj ...

Is it advisable to use an if statement or question mark in TypeScript to prevent the possibility of a null value?

Currently delving into TypeScript and exploring new concepts. I encountered a scenario where inputRef.current could potentially be null, so I opted to directly use a question mark which seems to work fine. However, in the tutorial video I watched, they use ...

The problem with uploading files in Angular4 (with multer on the server)

In my current project, I encountered an issue where the front end file was not getting transferred to the server side after finishing both the front end and back end logic. Despite spending more than an hour debugging, I couldn't pinpoint the exact ca ...

The declaration file for module 'react/jsx-runtime' could not be located

While using material-ui in a react project with a typescript template, everything is functioning well. However, I have encountered an issue where multiple lines of code are showing red lines as the code renders. The error message being displayed is: Coul ...

Ways to set a default value for a union type parameter without encountering the error "could be instantiated with a different subtype of constraint"

After referring to my recent inquiry... Can a default value be specified for valueProp in this scenario? type ValueType = 'value' | 'defaultValue' type Props<T extends ValueType> = Record<T, string> ...

My application is experiencing issues due to a malfunction when refreshing with query parameters in Angular 2

My URL contains query parameters, and after a successful transaction that clears those parameters, pressing the back button causes them to reappear. Additionally, if I refresh the page, an illegal action occurs - the same transaction is repeated and data ...