Sitelet https://github.com/replicate/replicate-javascript/issues/345
Skip to content

require function is used in a way in which dependencies cannot be statically extracted #345

Description

@jparismorgan

Hi there, I have a Next.js project with "replicate": "^1.0.1", and this code:

import Replicate from 'replicate'

export const replicate = new Replicate({
  auth: process.env.REPLICATE_API_KEY
})

I'm seeing this warning during local development:

- warn ../../node_modules/replicate/lib/util.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

Import trace for requested module:
../../node_modules/replicate/lib/util.js
../../node_modules/replicate/index.js
./src/lib/replicate.ts
./src/app/api/cloud/image/route.ts

from const ApiError = require("./error"); in node_modules/replicate/lib/util.js.

Any suggestions on preventing this?

Activity

  1. self-assigned this
    on Mar 26, 2025
  2. ntgussoni commented on May 23, 2025

    @ntgussoni

    I'm having the same issues as well, let me know if you guys need help testing it

    EDIT: v1.1.0-0

    This one removes the warning

  3. gianpaj commented on Jul 2, 2025

    @gianpaj

    when is this being released? we're in July 🙃

  4. saifookhan commented on Aug 18, 2025

    @saifookhan

    Pls take out time for this. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions