## TL;DR

For "TypeError: replicate_1.default is not a constructor": replace import Replicate from 'replicate' with import * as Replicate from 'replicate' and construct with new Replicate(...). _Source: https://github.com/replicate/replicate-javascript/issues/161 (Replicate)_ The default import does not resolve to the constructor outside TypeScript.

```text
TypeError: replicate_1.default is not a constructor
```

## Steps

1. `TypeError: replicate_1.default is not a constructor` in plain ES modules is an import-style problem, not a broken package. The default import does not resolve to the constructor outside TypeScript. Replace `import Replicate from 'replicate'` with `import * as Replicate from 'replicate'` and construct with `new Replicate(...)`.

2. _Source: https://github.com/replicate/replicate-javascript/issues/161 (Replicate)_

## When to use

You are seeing this: TypeError: replicate\_1.default is not a constructor in plain ES modules is an import-style problem, not a broken package. Use this skill when you run into "TypeError: replicate_1.default is not a constructor".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Sources

- https://github.com/replicate/replicate-javascript/issues/161
