question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

browserlist, TypeError: Class constructor "Component" cannot be invoked without 'new'

See original GitHub issue

TypeError: Class constructor "Component" cannot be invoked without 'new'

Using the create-react-app 3, why-did-you-render: v3.0.6 and this import:

const whyDidYouRender = require('@welldone-software/why-did-you-render/dist/no-classes-transpile/umd/whyDidYouRender.min.js')

why-did-you-render: v3.0.6

My browserlist:

  "browserslist": {
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

6reactions
frederikhorscommented, Apr 30, 2019

After several tests, I finally understood what is happening.

If in my package.json I use the new CRA 3 default below:

"browserslist": {
  "production": [
    ">0.2%",
    "not dead",
    "not op_mini all"
  ],
  "development": [
    "last 1 chrome version",
    "last 1 firefox version",
    "last 1 safari version"
  ]
}

deleting before npm start the node_modules/.cache folder it doesn’t work!

Re-deleting .cache folder with your below browserlist in package.json it works!

  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]

did you try “@welldone-software/why-did-you-render” before?

yes of course

0reactions
vzaidmancommented, Jun 2, 2019

@frederikhors as far as i know it should work. we have tests that verify these scenarios. there are, however, some serious issues with browserlist cache that are not related to the project.

please do the following:

  • change broserlist and babel config according to your need
  • delete node_modules/.cache
  • re-run

if the issue remains, you are free to reopen this issue and specify:

  • your current .browserlistrc
  • your babel config
  • how do you import wdyr
  • how do you use it and on what component
Read more comments on GitHub >

github_iconTop Results From Across the Web

Class constructor cannot be invoked without 'new' in JS
The "Class constructor cannot be invoked without 'new'" error occurs for 2 reasons: Trying to instantiate a class without using the new operator....
Read more >
How to fix `Class constructor LitElement cannot be invoked ...
The project structure is not an issue and parceljs will detect browserslist regardless of index.html and other source files location.
Read more >
Legacy browser support | Rest Hooks
If you see, Uncaught TypeError: Class constructor Resource cannot be invoked without 'new' this is most likely due to targeting Internet ...
Read more >
TypeError: Class constructor HTMLElement cannot be invoked ...
TypeError : Class constructor HTMLElement cannot be invoked without 'new' · 1) Install custom elements es5 adapter for your project. npm i custom- ......
Read more >
class constructor cannot be invoked without 'new' angular ...
TypeError : Class constructor Home cannot be invoked without 'new' ; 1. import React, { Component } from 'react' ; 2. import {...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found