Encountering "Error: Class constructor vA cannot be invoked without 'new'" when using Angular 10 Kendo Grid

I am currently working on integrating a Kendo Grid into my Angular application. However, I have run into an error when enabling the Kendo Grid component:

vendor.4add67dadae0cd9152b9.js:16 ERROR Error: Uncaught (in promise): TypeError: Class constructor vA cannot be invoked without 'new'
TypeError: Class constructor vA cannot be invoked without 'new'
    at new t (index.js:2890:28)
    at new e (index.js:6780:28)
    at Sg (core.js:23695:20)
    at _g (core.js:23564:22)
    // more stack trace goes here

Below is the relevant code snippet:

queue-grid.component.ts:

import { Component, OnInit, OnDestroy, Input, Inject } from "@angular/core";
import { ActivatedRoute, Router } from '@angular/router';
//... other import statements

@Component({
    selector: "queue-grid",
    moduleId: module.id.toString(),
    templateUrl: "./queue-grid.component.html",
    providers: [
        { provide: Window, useValue: window }
    ]
})
export class QueueGridComponent implements OnInit, OnDestroy {
    // ... component properties
    public isLoading: boolean = true; 

    constructor() {
        console.log("Queue Component Constructor");
        // ... initialization
        this.fetchData();
        console.log("constructor end");
    }

    ngOnInit() {
        console.log("Queue Component oninit ");
        console.log("Component oninit end");
    }

    fetchData() {
        // some code for fetching data
    }

    ngOnDestroy(): void {
    }
}

Relevant portion of queue-grid.component.html:


                                <div id="dvListData">
                                    <kendo-grid [data]="QueueListData?.data">

                                        <kendo-grid-column field="reference" title="Reference #"> </kendo-grid-column>
                                        <kendo-grid-column field="state" title="State"> </kendo-grid-column>
 
                                        <kendo-grid-column field="dueDate" title="Due Date"> </kendo-grid-column>
              ​
                                   </kendo-grid>
                                   
                                </div>
                           

Module's relevant part:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { GridModule } from '@progress/kendo-angular-grid'; 

@NgModule({
    imports: [
        GridModule 
    ],
    declarations: [
        QueueGridComponent
    ]
})
export class QueueGridModule { }

package.json:

"@angular/animations": "^10.2.2",
//....other package versions listed here
"zone.js": "^0.10.3"

Despite extensive research over several hours, I have not been able to find a solution to the "Class constructor vA cannot be invoked without 'new'" error within the context of Kendo Grid and Angular 10.

I experimented with updating TypeScript compiler options in tsconfig.json from es5 to es6 in hopes of resolving any compatibility issues, but unfortunately, the error persisted.

I ensured that the @progress/kendo-angular-grid installation was done correctly and verified the latest compatible versions of all Kendo-related packages were installed.

Further troubleshooting steps included checking syntax for using Kendo Grid component in the template and simplifying the grid to remove features like sorting, paging, and filtering to isolate the issue. I also verified the presence of Kendo UI grid files in the node_modules folder.

Additionally, attempts were made to clean the npm cache and reinstall node_modules to rule out any potential package corruption issues (e.g., npm cache clean --force and npm install).

If anyone could assist in resolving this error, it would be greatly appreciated!

Answer №1

If you're facing an issue, consider including the following snippet in your Webpack setup:

resolve: {
      mainFields: ['es2015', 'browser', 'module', 'main']
    }

By doing so, Webpack will be able to correctly identify the module entry points, potentially preventing problems such as those involving class constructors and module loading.

Take a look at this link for more information

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

Tips for using rspec to test front end functionality?

In my Rails project, I have incorporated Vue.js using only the core library. Currently, most forms in the project are developed with Vue.js. When testing front-end features like form filling or validations using feature tests in RSpec, I found it to be qui ...

Unleashing the Power of Object Destructuring in React Hooks

Here is a straightforward code snippet: import React from "react"; import { useForm } from "react-hook-form"; export default function App() { const { register, formState: { errors }, handleSubmit } = useForm(); return ( < ...

Sorry, but I can't help with that request

Since the latest update of Angular Material, I have encountered some issues with my <md-menu> components. Previously, everything was functioning well with the import of MaterialModule. However, after switching to MatMenuModule or MdMenuModule, an err ...

react application - Displaying the future value of a variable on the console log

Just starting with react. Superior component : // manages the json order parsed from child and retrieves the parsed data // child component invokes this method by calling this.props.onAdded() handleAdded = (orderData) => { let items = orderDat ...

What is the method for deactivating an option with multiple values that are separated by commas?

I am working with a unique situation where I have options that contain multiple values $('#addItemModal #servicesBlock select[name=service_id] option[value='+service.val()+']').prop('disabled', true); <script src="https: ...

What is the best way to retrieve the value of the selected mat-option?

I've been struggling to extract the selected value of a mat-option using this specific HTML and TypeScript code. html <mat-form-field appearance="outline" floatLabel="always"> <mat-label>TRA Type</mat-label> ...

Updating ngModel using the value retrieved from a service call

After experiencing dissatisfaction with Angular's form validation, I decided to develop my own solution. However, I have encountered a perplexing issue that has me at a loss. Here is how my setup looks: I employ a directive to create a new form. Th ...

"Troubleshooting the path problem in Vue.js router version 3.0.1

Encountered an unexpected issue and seeking assistance for resolution. Below is a snippet of the route configuration that I am currently dealing with: routes: [ { path: '/signin', name: 'signin', component: SignIn }, ...

"Experience the power of Angular.js through seamless animations created by blending the capabilities

I want to smoothly fade out the old view and fade in the new view. The challenge is that the new content must be positioned absolutely until the old one fades out. I also want to set a specific top position and height for the new content, but when I try to ...

Are you wondering why there isn't a straightforward solution for swapping page content using JavaScript?

Is there truly no straightforward solution to the issue at hand - specifically, swapping HTML content on web pages? In this scenario, using jquery's load() isn't viable because I need to load a file locally for Node-webkit, and due to Cross orig ...

Experiencing difficulty receiving a full response from an ajax-php request displayed in a div

Having trouble getting a response in a div from an ajax request triggered by an onclick event in a form and a PHP page. Here's the code: <html> <head> <script language="javascript"> function commentRequest(counter) { new Ajax. ...

Please ensure that the property name is a valid type, such as 'string', 'number', 'symbol', or 'any'

Can anyone help me convert this JavaScript file to Typescript? import React, { useState } from 'react'; import { Button } from './Button'; import { Link } from 'react-router-dom'; import './Navbar.css'; import Settin ...

What is the proper way to define and update a variable within a React Class Component in order to maintain a reference to a setTimeout function

Having primarily worked with React function components, my typical approach is to declare consts inside the function. However, I recently encountered a situation where I needed to declare a variable in a class component, and I experimented with three diffe ...

Setting the z-index for a JavaScript plugin

I need help with embedding the LinkedIn plugin into a website that has stacked images using z-index for layout. I have tried assigning the plugin to a CSS class with a z-index and position properties, but it hasn't worked as expected. Can anyone sugge ...

Despite importing jQuery, the variable '$' cannot be located

Whenever I try to click the button labeled test, it doesn't do anything. However, an error message appears in the console debug indicating: Error: Unable to locate variable '$'. I suspect this might be a jQuery issue, even though I' ...

trouble combining two arrays of JavaScript objects

I'm facing a challenge with an object array. I need to add a new object "WITH" a specific index, but I'm unsure of the correct approach. This is my current attempt: //ORIGINAL DATA: this.fetchedData = [{ "startMinute": 0, //Remove "annotati ...

Taking advantage of Input decorator to access several properties in Angular 2

I am currently working on a component that is designed to receive two inputs through its selector. However, I would like to make it flexible enough to accept any number of inputs from various components. Initially, I tried using a single @Input() decorator ...

What is the reason behind the absence of a hide/show column feature in the Kendo Grid for Angular?

In my Angular application, I have implemented a Kendo Grid for Angular with the columnMenu feature enabled. This feature allows users to hide/show columns from a popup: https://i.sstatic.net/B5VXo.png Surprisingly, upon checking the ColumnMenu documentat ...

Understanding which page is being rendered through _app.js in React/Next.js is crucial for seamless navigation and

Currently, I am working on rendering my web navigation and footer on my _app.js file. My goal is to dynamically adjust the style of the navigation and footer based on the specific page being accessed. Initially, I considered placing the navigation and foot ...

Troubleshooting issues with multiple $scope.$watch functions in AngularJS

I'm having an issue where only the first $watch function is firing in the same controller. Both inputs have ng-model assigned to them. Can someone help me understand why this is happening? (appreciate any help) $scope.$watch('search', funct ...