Skip to content

contentful is undefined when importing via ES6 style #2241

@y-lobau

Description

@y-lobau

The documentation states:

import contentful from 'contentful-management'
const client = contentful.createClient(
  {
    // This is the access token for this space. Normally, you get the token in the Contentful web app
    accessToken: 'YOUR_ACCESS_TOKEN',
  },
  { type: 'plain' }
)

When running this code from within the Contentful App (react), the contentful variable is undefined.

image

I was able to make it work with the following instead:

import { createClient } from "contentful-management";
const client =createClient...

Node.js: v21.7.1
contentful-management: 11.24.3

Metadata

Metadata

Assignees

No one assigned

    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