Errors / JavaScript errors
Uncaught TypeError: x is not a constructor
A script tried to create something from a library that was not loaded the way it expected.
Whatever that class builds (a map, a carousel, a chart) does not appear.
Why it happens
- An import that got the module instead of the class: a default export used as a named one, or the other way round.
- A library loaded from a CDN in a different version, where the class moved or was renamed.
- Calling
newon an arrow function or on something that is not a class.
How to fix it
- Check how the library exports it (
import Swiper from "swiper"versusimport { Swiper } from "swiper"). - Pin the CDN version in the script URL instead of taking the latest.
- Log the value to see what it actually is.
Whose problem it is
Either the site's own code or a third party's, depending on where it comes from.
Does your site have it?
Free, no account. We open your page and four more in a clean Chrome and list every error like this one, with the page and the click that caused it. How the free page check works.
Often seen with
- x is not a functionA script tried to use something as an action that is not one, and stopped.