Skip to content

ESM build of decap-cms-widget-richtext includes invalid imports #7796

Description

@delucis

Describe the bug
When using decap-cms-app in an Astro/Vite app, there are issues due incorrect import statements in the decap-cms-widget-richtext.

For example I get:

✘ [ERROR] No matching export in "node_modules/.pnpm/unist-util-visit-parents@6.0.2/node_modules/unist-util-visit-parents/index.js" for import "default"

    node_modules/.pnpm/decap-cms-widget-richtext@3.2.1_@emotion+react@11.14.0_@types+react@19.2.14_react@19.2.5__@em_hhy545oktf22w3cpgrsx7kwr6i/node_modules/decap-cms-widget-richtext/dist/esm/serializers/remarkAssertParents.js:2:7:
      2 │ import visitParents from 'unist-util-visit-parents';
        ╵        ~~~~~~~~~~~~

visitParents is a named export of unist-util-visit-parents, not a default export so the resolution fails here:

import visitParents from 'unist-util-visit-parents';

The same issue is present for the import of mdastDefinitions here:

import mdastDefinitions from 'mdast-util-definitions';

Expected behavior

The imports should be correct

Applicable Versions:

  • Decap CMS version: "decap-cms-app": "^3.12.2"
  • OS: macOS
  • Browser version: Firefox 150
  • Node.JS version: 24.15

CMS configuration
This happens with any config, even when not using the rich text widget

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions