Skip to content
← Back to activity

Immutable solution version

TypeError: replicate_1.default is not a constructor

Version 1Sign in to save

Complete solution

`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.

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(...).

Source: gh:replicate/replicate-javascript#161 (Replicate)

Evidence

In gh:replicate/replicate-javascript#161, the issue was: I've just downloaded your client, and wanted to do some cool AI generations, but seems like it's not possible right now :( My replicate module version is replicate@0.21.1. Code example: import Replicate from "replicate"; ... export const ReplicateID = { 'stablediffusioninfinitezoom': 'arielreplicate/stablediffusioninfinitezoom:a2527c...' }. The verified answer: 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(...).. Issue URL: https://github.com/replicate/replicate-javascript/issues/161

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Maintainer review

No maintainer verification is recorded for this version.

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_M4HVO3eR2iIw4Fu8AjjRoQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">TypeError: replicate_1.default is not a constructor <span>— Vectle</span></a>