Skip to content

astro 7.3.1: astrojs/mdx with internal path issue #17926

Closed

Description

@mahlzahn

Astro Info

Astro                    v7.3.1
Node                     v26.4.0
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/sitemap
                         @astrojs/mdx
                         astro-icon

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

No response

Describe the Bug

This looks like another occurence of #17898 and #17897, but after the fix added in #17899:

[GenerateContentTypesError] `astro sync` command failed to generate content collection types: "./mdx" is not exported under the conditions ["module", "node", "production", "astro", "import"] from package node_modules/@astrojs/internal-helpers (see exports field in node_modules/@astrojs/internal-helpers/package.json).
  Hint:
    This error is often caused by a syntax error inside your content, or your content configuration file. Check your src/content.config.ts file for typos.
  Error reference:
    https://docs.astro.build/en/reference/errors/generate-content-types-error/
  Stack trace:
    at syncContentCollections (file://node_modules/.pnpm/astro@7.3.1_@emnapi+core@1.11.1_@emnapi+runtime@1.11.3_@types+node@24.13.3_jiti@2.7.0_yaml@2.9.0/node_modules/astro/dist/core/sync/index.js:256:11)
    at async AstroBuilder.setup (file://node_modules/.pnpm/astro@7.3.1_@emnapi+core@1.11.1_@emnapi+runtime@1.11.3_@types+node@24.13.3_jiti@2.7.0_yaml@2.9.0/node_modules/astro/dist/core/build/index.js:109:7)
    at async build (file://node_modules/.pnpm/astro@7.3.1_@emnapi+core@1.11.1_@emnapi+runtime@1.11.3_@types+node@24.13.3_jiti@2.7.0_yaml@2.9.0/node_modules/astro/dist/core/build/index.js:50:3)
    at async runCommand (file://node_modules/.pnpm/astro@7.3.1_@emnapi+core@1.11.1_@emnapi+runtime@1.11.3_@types+node@24.13.3_jiti@2.7.0_yaml@2.9.0/node_modules/astro/dist/cli/index.js:192:7)
  Caused by:
  "./mdx" is not exported under the conditions ["module", "node", "production", "astro", "import"] from package node_modules/@astrojs/internal-helpers (see exports field in node_modules/@astrojs/internal-helpers/package.json)
    at async EnvironmentPluginContainer.resolveId (file://node_modules/.pnpm/vite@8.2.2_@types+node@24.13.3_esbuild@0.28.2_jiti@2.7.0_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:30848:19)
    at async EnvironmentPluginContainer.resolveId (file://node_modules/.pnpm/vite@8.2.2_@types+node@24.13.3_esbuild@0.28.2_jiti@2.7.0_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:30848:19)
    at async normalizeUrl (file://node_modules/.pnpm/vite@8.2.2_@types+node@24.13.3_esbuild@0.28.2_jiti@2.7.0_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:28075:22)
    at async Promise.all (index 4)
    at async EnvironmentPluginContainer.transform (file://node_modules/.pnpm/vite@8.2.2_@types+node@24.13.3_esbuild@0.28.2_jiti@2.7.0_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:30932:14)

What's the expected result?

No issue like it was with astro 7.2.9.

Link to Minimal Reproducible Example

Not yet, I failed to create a minimal reproducer there.

Participation

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

Activity

  1. added
    triage: in progress
    on Sep 7, 2026
  2. astro-factory commented on Sep 7, 2026

    @astro-factory
    Contributor

    Triage complete

    • Prepare the workspace: ready
    • Install dependencies: complete
    • Build the project: complete
    • Reproduce the issue: not reproduced
    • Diagnose the cause: not needed (the issue was not reproduced)
    • Verify the diagnosis: not needed (the issue was not reproduced)
    • Attempt a fix: not needed (the issue was not reproduced)
    • Publish the result: set triage: unable to reproduce

    • Reproduced: No
    • Exploration: No — could not reproduce the error to investigate further
    • Unit Test: No — issue not reproducible
    • Priority: P3: minor bug. The error is build-breaking for the reporter, but likely caused by a project-specific dependency resolution issue rather than a code defect. The reporter also could not create a minimal reproduction.

    The reported error ("./mdx" is not exported ... from package node_modules/@astrojs/internal-helpers) points to astro@7.3.1's dist/core/viteUtils.js, which imports @astrojs/internal-helpers/mdx. This subpath was added in @astrojs/internal-helpers@0.11.0 (released with astro@7.2.10), and astro@7.3.1 correctly declares a dependency on @astrojs/internal-helpers@0.11.0 — which has the "./mdx" export. I tested with both the correct package versions (astro@7.3.1 + @astrojs/mdx@8.0.0) and a version-mismatched scenario (astro@7.3.1 + @astrojs/mdx@7.0.8); both astro sync and astro build succeeded without error.

    I was unable to determine the cause of this issue. The most likely explanations are: (1) a stale node_modules or lockfile causing an older @astrojs/internal-helpers (0.10.x, which lacks the ./mdx export) to be resolved at runtime, (2) a Node v26-specific module resolution behavior (we tested on Node v22), or (3) a pnpm deduplication/hoisting quirk specific to the reporter's dependency tree. Deleting node_modules and pnpm-lock.yaml and reinstalling may resolve this.

    Full Triage Report

    Issue Summary

    Title: astro 7.3.1: astrojs/mdx with internal path issue

    Reporter says: After upgrading to astro 7.3.1 (from 7.2.9), they get an error during astro sync / astro build:

    [GenerateContentTypesError] `astro sync` command failed to generate content collection types: "./mdx" is not exported under the conditions ["module", "node", "production", "astro", "import"] from package node_modules/@astrojs/internal-helpers (see exports field in node_modules/@astrojs/internal-helpers/package.json).
    

    The error occurs in syncContentCollections → Vite's EnvironmentPluginContainer.transform → normalizeUrl → resolveId chain.

    Environment:

    • Astro v7.3.1
    • Node v26.4.0
    • Linux (x64)
    • pnpm
    • Static output, no adapter
    • Integrations: @astrojs/sitemap, @astrojs/mdx, astro-icon

    Related issues: #17898, #17897, #17899 (similar export resolution issues, #17899 was a fix for a related astro/_internal/logger export issue)

    Reproduction Attempts

    What was tried

    1. Published packages with correct versions (astro@7.3.1 + @astrojs/mdx@8.0.0):

      • Created a fresh project with content collections using the glob loader
      • Added MDX files with images
      • Ran astro sync and astro build
      • Result: No error. Both sync and build succeeded.
    2. Published packages with version mismatch (astro@7.3.1 + @astrojs/mdx@7.0.8):

      • Simulated a scenario where the user might have an older MDX integration
      • Both @astrojs/internal-helpers@0.10.4 and @astrojs/internal-helpers@0.11.0 were installed side-by-side
      • Ran astro sync and astro build
      • Result: No error. Both sync and build succeeded.
    3. Workspace (HEAD) versions:

      • Used workspace:* dependencies in the monorepo
      • Result: No error.

    Analysis of the codebase

    The ./mdx export in @astrojs/internal-helpers was added in PR #17262 (commit f8e9458), released as @astrojs/internal-helpers@0.11.0 alongside astro@7.2.10 and @astrojs/mdx@8.0.0.

    The import chain:

    • packages/astro/src/core/viteUtils.ts has export { resolvePath } from '@astrojs/internal-helpers/mdx'
    • This compiles to astro/dist/core/viteUtils.js which is shipped in the published astro@7.3.1
    • astro@7.3.1 declares a dependency on @astrojs/internal-helpers@0.11.0 (the workspace:* resolves to this during publish)
    • @astrojs/internal-helpers@0.11.0 on npm correctly has "./mdx": "./dist/mdx.js" in its exports map

    The error occurs during Vite's transform → normalizeUrl → resolveId chain, meaning Vite is processing some module that contains import ... from '@astrojs/internal-helpers/mdx' and failing to resolve it.

    Possible causes (not confirmed)

    1. Stale node_modules or lockfile: The user may have residual @astrojs/internal-helpers@0.10.x from a previous install that doesn't have the ./mdx export
    2. Node v26.4.0: The user is on Node v26 which may have different module resolution behavior (we tested on Node v22)
    3. pnpm version differences: Different pnpm versions may handle package deduplication and hoisting differently
    4. Other project-specific configuration: The user has astro-icon and potentially other packages that could affect dependency resolution
    5. The reporter couldn't create a minimal reproduction — "Not yet, I failed to create a minimal reproducer there"

    Conclusion

    Not reproducible. The issue could not be reproduced with the published packages on Node v22 with pnpm v10.34.5. The reporter also could not create a minimal reproduction. The exported subpath ./mdx correctly exists in @astrojs/internal-helpers@0.11.0 (the version that astro@7.3.1 depends on).

    This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.

  3. added
    triage: unable to reproduce
    and removed
    triage: in progress
    on Sep 7, 2026
  4. mahlzahn commented on Sep 7, 2026

    @mahlzahn
    Author

    Additional info:

    1. It failed already with astro 7.2.10:
      [GenerateContentTypesError] `astro sync` command failed to generate content collection types: "./mdx" is not exported under the conditions ["module", "node", "production", "astro", "import"] from package /workspace/forgejo/website/node_modules/@astrojs/internal-helpers (see exports field in /workspace/forgejo/website/node_modules/@astrojs/internal-helpers/package.json).
      Hint:
        This error is often caused by a syntax error inside your content, or your content configuration file. Check your src/content.config.ts file for typos.
      Error reference:
        https://docs.astro.build/en/reference/errors/generate-content-types-error/
      Stack trace:
        at syncContentCollections (file:///workspace/forgejo/website/node_modules/.pnpm/astro@7.2.10_@emnapi+core@1.11.1_@emnapi+runtime@1.11.3_@types+node@24.13.3_jiti@2.7.0_yaml@2.9.0/node_modules/astro/dist/core/sync/index.js:256:11)
        at async AstroBuilder.setup (file:///workspace/forgejo/website/node_modules/.pnpm/astro@7.2.10_@emnapi+core@1.11.1_@emnapi+runtime@1.11.3_@types+node@24.13.3_jiti@2.7.0_yaml@2.9.0/node_modules/astro/dist/core/build/index.js:109:7)
        at async build (file:///workspace/forgejo/website/node_modules/.pnpm/astro@7.2.10_@emnapi+core@1.11.1_@emnapi+runtime@1.11.3_@types+node@24.13.3_jiti@2.7.0_yaml@2.9.0/node_modules/astro/dist/core/build/index.js:50:3)
        at async runCommand (file:///workspace/forgejo/website/node_modules/.pnpm/astro@7.2.10_@emnapi+core@1.11.1_@emnapi+runtime@1.11.3_@types+node@24.13.3_jiti@2.7.0_yaml@2.9.0/node_modules/astro/dist/cli/index.js:192:7)
      Caused by:
      "./mdx" is not exported under the conditions ["module", "node", "production", "astro", "import"] from package /workspace/forgejo/website/node_modules/@astrojs/internal-helpers (see exports field in /workspace/forgejo/website/node_modules/@astrojs/internal-helpers/package.json)
        at async EnvironmentPluginContainer.resolveId (file:///workspace/forgejo/website/node_modules/.pnpm/vite@8.2.2_@types+node@24.13.3_esbuild@0.28.2_jiti@2.7.0_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:30848:19)
        at async EnvironmentPluginContainer.resolveId (file:///workspace/forgejo/website/node_modules/.pnpm/vite@8.2.2_@types+node@24.13.3_esbuild@0.28.2_jiti@2.7.0_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:30848:19)
        at async normalizeUrl (file:///workspace/forgejo/website/node_modules/.pnpm/vite@8.2.2_@types+node@24.13.3_esbuild@0.28.2_jiti@2.7.0_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:28075:22)
        at async Promise.all (index 4)
        at async EnvironmentPluginContainer.transform (file:///workspace/forgejo/website/node_modules/.pnpm/vite@8.2.2_@types+node@24.13.3_esbuild@0.28.2_jiti@2.7.0_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:30932:14)
    
    1. concerning

    I was unable to determine the cause of this issue. The most likely explanations are:
    (1) a stale node_modules or lockfile causing an older @astrojs/internal-helpers (0.10.x, which lacks the ./mdx export) to be resolved at runtime,

    Deleting node_modules and pnpm-lock.yaml and reinstalling and recreating locks did not help.

    (2) a Node v26-specific module resolution behavior (we tested on Node v22), or

    a) Same happens with Node v24.19.0, b) it didn’t happen with astro v7.2.9

    (3) a pnpm deduplication/hoisting quirk specific to the reporter's dependency tree. Deleting node_modules and pnpm-lock.yaml and reinstalling may resolve this.

    Same as (1).

  5. added
    triage: needs triage
    triage: in progress
    and removed
    triage: unable to reproduce
    triage: needs triage
    on Sep 7, 2026
  6. astro-factory commented on Sep 7, 2026

    @astro-factory
    Contributor

    Triage complete

    • Prepare the workspace: ready
    • Install dependencies: complete
    • Build the project: complete
    • Reproduce the issue: not reproduced
    • Diagnose the cause: not needed (the issue was not reproduced)
    • Verify the diagnosis: not needed (the issue was not reproduced)
    • Attempt a fix: not needed (the issue was not reproduced)
    • Publish the result: set triage: unable to reproduce

    • Reproduced: No
    • Exploration: No — could not reproduce the error to investigate further
    • Unit Test: No — issue not reproducible
    • Priority: P3: minor bug. The error is build-breaking for the reporter, but we could not reproduce it in any test scenario, and the reporter was unable to provide a minimal reproduction. This likely affects only specific project configurations.

    The reported error ("./mdx" is not exported ... from package @astrojs/internal-helpers) points to @astrojs/internal-helpers/mdx, a subpath export added in @astrojs/internal-helpers@0.11.0 (released with astro@7.2.10). Both astro@7.3.1 and @astrojs/mdx@8.0.0 correctly depend on @astrojs/internal-helpers@0.11.0, which includes the ./mdx export. We tested three scenarios — workspace (HEAD), published packages with npm, and published packages with pnpm including astro-icon — and astro sync / astro build succeeded in all cases.

    I was unable to determine the cause of this issue. The most likely explanation is a dependency resolution issue specific to the reporter's project. The stack trace path (/workspace/forgejo/website/node_modules/...) suggests a monorepo or workspace setup that may cause pnpm to resolve an older @astrojs/internal-helpers@0.10.x (which lacks the ./mdx export) instead of 0.11.0. To help us investigate further, could you:

    1. Share the output of cat node_modules/@astrojs/internal-helpers/package.json | grep version (or the equivalent path in your pnpm store) to confirm which version is being resolved?
    2. Share the relevant parts of your pnpm-lock.yaml showing how @astrojs/internal-helpers is resolved?
    3. If possible, provide a minimal reproduction — even a package.json + pnpm-lock.yaml that triggers the issue would be very helpful.
    Full Triage Report

    Issue Summary

    Title: astro 7.3.1: astrojs/mdx with internal path issue

    Reporter: @mahlzahn

    Description: After upgrading to astro 7.3.1 (and also 7.2.10) from 7.2.9, astro sync and astro build fail with:

    [GenerateContentTypesError] `astro sync` command failed to generate content collection types: "./mdx" is not exported under the conditions ["module", "node", "production", "astro", "import"] from package node_modules/@astrojs/internal-helpers (see exports field in node_modules/@astrojs/internal-helpers/package.json).
    

    The error occurs in syncContentCollections → Vite's EnvironmentPluginContainer.transform → normalizeUrl → resolveId chain.

    Environment (from reporter):

    • Astro v7.3.1 (also fails on v7.2.10, worked on v7.2.9)
    • Node v26.4.0 (also reproduces on v24.19.0)
    • Linux (x64)
    • pnpm
    • Static output, no adapter
    • Integrations: @astrojs/sitemap, @astrojs/mdx, astro-icon

    Related issues: #17898, #17897, #17899

    Root Cause Analysis

    The ./mdx export was added to @astrojs/internal-helpers in version 0.11.0, released alongside astro@7.2.10. The previous version @astrojs/internal-helpers@0.10.4 does not have the ./mdx export. If the wrong version were resolved at runtime, this error would occur.

    In all testing, the correct version (0.11.0) was resolved and the export worked correctly.

    Reproduction Attempts

    Attempt 1: Workspace (HEAD) packages

    • Created project with workspace:* deps for astro, @astrojs/mdx, @astrojs/sitemap
    • Added content collections with MDX files and image references
    • astro sync succeeded
    • astro build succeeded
    • Result: NOT REPRODUCED

    Attempt 2: Published packages with npm

    • Created isolated project with astro@7.3.1, @astrojs/mdx@^8.0.0, @astrojs/sitemap@^3.7.0
    • Verified @astrojs/internal-helpers@0.11.0 was installed with ./mdx export present
    • astro sync and astro build both succeeded
    • Result: NOT REPRODUCED

    Attempt 3: Published packages with pnpm + astro-icon

    • Created isolated project matching the reporter's setup (pnpm, astro-icon)
    • Verified @astrojs/internal-helpers@0.11.0 was in the pnpm store with ./mdx export
    • astro sync and astro build both succeeded
    • Result: NOT REPRODUCED

    Conclusion

    The issue could not be reproduced. Possible explanations:

    1. A dependency resolution quirk in the reporter's project causing @astrojs/internal-helpers@0.10.4 (without ./mdx) to be resolved instead of 0.11.0
    2. An interaction with the reporter's specific pnpm workspace/monorepo setup (path suggests /workspace/forgejo/website/)
    3. A Node v26-specific module resolution behavior (tested only on Node v22)

    This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.

  7. added
    triage: unable to reproduce
    and removed
    triage: in progress
    on Sep 7, 2026
  8. mahlzahn commented on Sep 7, 2026

    @mahlzahn
    Author

    The most likely explanation is a dependency resolution issue specific to the reporter's project. The stack trace path (/workspace/forgejo/website/node_modules/...) suggests a monorepo or workspace setup that may cause pnpm to resolve an older @astrojs/internal-helpers@0.10.x (which lacks the ./mdx export) instead of 0.11.0.

    That was the reason, mdx itself was not updated to latest version, yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage: unable to reproduce

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions