Skip to content

[Bug]: Standalone docs build imports the product middleware #1306

Description

@HaningZS

Bug Description

The standalone Fumadocs application under packages/docs no longer builds on current main (9d16e682). Its Turbopack project includes the repository-root middleware.ts, then resolves that file's root alias relative to packages/docs:

Module not found: Can't resolve '@/lib/config/feature-flags'
Import map: aliased to relative './lib/config/feature-flags' inside of [project]/packages/docs

Reproduction

cd packages/docs
pnpm install --frozen-lockfile --ignore-workspace
pnpm build

The MDX generation step succeeds, but next build fails while compiling ./middleware.ts from the repository root.

Root Cause and Regression Window

  • packages/docs is a separate Next.js app with its own lockfile, tsconfig, alias, and GitHub workflow.
  • Its next.config.mjs does not explicitly bound the Turbopack root to the docs package.
  • Commit 04621578 (OpenMAIC v1.0.0, August 27) added @/lib/config/feature-flags to the repository-root middleware.
  • The most recent Docs Build workflow ran successfully on August 13, before that import was added.
  • The docs workflow path filter does not include the root middleware, so the v1.0 change did not run the standalone docs build on main.

Before the new root-only import, accidentally compiling the root middleware did not expose the project-boundary leak. It now does.

Expected Behavior

The packages/docs build should be isolated to the docs application and should not discover or compile the product application's root middleware.

Proposed Scope

Set the docs app's Turbopack root explicitly to the packages/docs directory in packages/docs/next.config.mjs. Do not copy product feature flags into the docs app or weaken the root middleware alias.

Acceptance Criteria

  • pnpm build succeeds from packages/docs on Node 22 with its standalone lockfile.
  • The static export and all configured locale routes are generated.
  • pnpm types:check remains green.
  • The root OpenMAIC build/configuration is unchanged.
  • A future docs PR triggers and passes the existing Docs Build workflow.

This report and proposed fix are AI-assisted and were manually reproduced on current main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions