Skip to content

tihs package uses non-ESM dependencies in a way that is not compatible with pure ESM environments #263

@NullVoxPopuli

Description

@NullVoxPopuli

Initial checklist

Affected package

unified

Steps to reproduce

I'm building a library that uses unified. So I can't mandate consumers have specific exceptions for unified using cjs dependencies in the dependency graph.

Try vite 6, or rollup with a project that uses unified (or any other ESM-based packager (esm.sh with no pre-build, for example))

Problem comes from here:

import extend from 'extend'

I did see this issue: #153
But, because I'm a library author, not an app dev, the solutions in that issue are not possible.

Actual behavior

This error:

[!] RollupError: ../../node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js (350:7): "default" is not exported by "../../node_modules/.pnpm/[email protected]/node_modules/extend/index.js", imported by "../../node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js".
https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module
../../node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js (350:7)
348: 
349: import {bail} from 'bail'
350: import extend from 'extend'
            ^
351: import {ok as assert} from 'devlop'
352: import isPlainObj from 'is-plain-obj'

Expected behavior

either

  • extend gets a default export
  • we drop the extend library 🙈

See: https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module

Runtime

node 24

Package manager

rollup 4.x

Operating system

doesn't matter

Build and bundle tools

Rollup

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