Skip to content

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 new on an arrow function or on something that is not a class.

How to fix it

  1. Check how the library exports it (import Swiper from "swiper" versus import { Swiper } from "swiper").
  2. Pin the CDN version in the script URL instead of taking the latest.
  3. 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.

Check only sites you run or have permission to check.

Often seen with