Skip to content

@astrojs/mdx imports satteri but does not declare it (pnpm ERR_MODULE_NOT_FOUND) #17371

Description

@grant

Astro Info

Astro                    v7.0.6
Node                     v22+
System                   macOS / Linux
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/mdx

If this issue only occurs in one browser, which browser is a problem?

N/A (build / Node module resolution)

Describe the Bug

@astrojs/mdx statically imports satteri in its Sätteri MDX entrypoints, for example:

https://github.com/withastro/astro/blob/@astrojs/mdx@7.0.3/packages/integrations/mdx/src/satteri/index.ts

import {
	mdxToJs,
	// ...
} from 'satteri';

But packages/integrations/mdx/package.json does not list satteri in dependencies. It only declares optional peer @astrojs/markdown-satteri (which itself depends on satteri), and historically kept satteri in devDependencies only.

With pnpm's isolated node_modules and a normal Astro + MDX project (integrations: [mdx()] + an .mdx page):

  1. There is no satteri symlink beside @astrojs/mdx
  2. astro build often still succeeds by walking up to node_modules/.pnpm/node_modules/satteri
  3. When that link is missing, astro build fails while compiling MDX:
[ERROR] [vite] ✗ Build failed
Cannot find package 'satteri' imported from
.../node_modules/@astrojs/mdx/dist/satteri/index.js
  at .../@astrojs/mdx/dist/vite-plugin-mdx.js

Reproduced on @astrojs/mdx@7.0.3. main still omits satteri from @astrojs/mdx dependencies.

Related: #17072 addressed optional Sätteri loading for the Container API path, but does not declare satteri for the default Sätteri MDX processor path used when @astrojs/markdown-satteri is present (pulled in by astro itself on Astro 7).

What's the expected result?

astro build on an MDX page should succeed under pnpm without relying on an accidental .pnpm/node_modules/satteri link. satteri should be a declared dependency of @astrojs/mdx so pnpm links it into @astrojs/mdx's isolated node_modules.

Link to Minimal Reproducible Example

https://github.com/grant/astro-mdx-satteri-undeclared-dep-repro

Minimal Astro project with:

  • astro.config.mjsintegrations: [mdx()]
  • src/pages/post.mdx → MDX page compiled during astro build
pnpm install
pnpm repro

pnpm repro runs a real astro build twice:

  1. With .pnpm/node_modules/satteri present → build succeeds
  2. After temporarily removing that link → astro build fails with Cannot find package 'satteri' from @astrojs/mdx/dist/satteri/index.js

Manual steps are also in the README.

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P4: importantViolate documented behavior or significantly impacts performance (priority)pkg: mdxIssues pertaining to `@astrojs/mdx` integrationtriage: fix pendingReporter needs to verify the triage bot fix works

    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