Skip to content

Can't get the import working in TypeScript #185

Open
@arpadgabor

Description

@arpadgabor

I'm gettin this error when I'm trying to initialize the widget manually in typescript:

Error: Element type is invalid: expected a string (for built-in components)
or a class/function (for composite components) but got: undefined.

You likely forgot to export your component from the file it's defined in,
or you might have mixed up default and named imports. Check the render method of `h`.

This is what I'm trying to do:

import { Control, Preview } from '@netlify/netlify-cms-widget-parent'

CMS.registerWidget('parent', Control, Preview)

// same story with

import * as NetlifyCmsWidgetParent from '@netlify/netlify-cms-widget-parent'

CMS.registerWidget('parent', NetlifyCmsWidgetParent.Control, NetlifyCmsWidgetParent.Preview)

Not sure if I'm doing anything wrong. The plugin works though by initializing using the script.

I'd help with this but I'm not sure where the problem is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions