Skip to content

Docusaurus Faster failed to build under yarn PnP mode #10787

Closed

Description

@smeng9

Have you read the Contributing Guidelines on issues?

Prerequisites

Description

I expect the docusaurus faster to be working out of the box with yarn in a clean template project however it is not.

Reproducible demo

https://stackblitz.com/edit/github-vzunfajq?file=package.json,docusaurus.config.ts

Steps to reproduce

  1. Perform $ npm init docusaurus@latest with classic and TypeScript
  2. Set the package manager to latest yarn to install dependencies PnP mode $ yarn set version canary && yarn
  3. Update the docusaurus.config.ts to enable future.experimental_faster to true
  4. Build the website $ yarn build

Expected behavior

The website should be able to build

Actual behavior

It throws errors for build
● Client ██████████████████████████████████████████████████ (93%) sealing after asset optimization
● Server ██████████████████████████████████████████████████ (93%) sealing after asset optimization [ERROR] Client bundle compiled with errors therefore further build is impossible.
× Module not found: Can't resolve '/Users/[redacted]/Developer/website/.yarn/virtual/@docusaurus-core-virtual-7a135ef58f/3/.yarn/berry/cache/@docusaurus-core-npm-3.6.3-a0940a712c-10c0.zip/node_modules/@docusaurus/core/lib/client/clientEntry.js' in '/Users/[redacted]/Developer/website'

and errors for start
[INFO] Starting the development server...
[SUCCESS] Docusaurus website is running at: http://localhost:3000/
● Client ██████████████████████████████████████████████████ (100%) emitting after emit × Module not found: Can't resolve '/Users/[redacted]/Developer/website/.yarn/virtual/@docusaurus-core-virtual-7a135ef58f/3/.yarn/berry/cache/@docusaurus-core-npm-3.6.3-a0940a712c-10c0.zip/node_modules/@docusaurus/core/lib/client/clientEntry.js' in '/Users/[redacted]/Developer/website'


× Module not found: Can't resolve '/Users/[redacted]/Developer/website/.yarn/virtual/webpack-virtual-20fb5ab00f/3/.yarn/berry/cache/webpack-npm-5.97.1-b41b9903c1-10c0.zip/node_modules/webpack/hot/dev-server.js' in '/Users/[redacted]/Developer/website'


× Module not found: Can't resolve '/Users/[redacted]/Developer/website/.yarn/virtual/webpack-dev-server-virtual-13f949419a/3/.yarn/berry/cache/webpack-dev-server-npm-4.15.2-56919849cc-10c0.zip/node_modules/webpack-dev-server/client/index.js?protocol=ws%3A&hostname=0.0.0.0&port=0&pathname=%2Fws&logging=warn&progress=true&overlay=%7B%22errors%22%3Atrue%2C%22warnings%22%3Afalse%7D&reconnect=10&hot=true&live-reload=false' in '/Users/[redacted]/Developer/website'


× Error: Child compilation failed:
│ × Module not found: Can't resolve '/Users/[redacted]/Developer/website/.yarn/virtual/@docusaurus-core-virtual-7a135ef58f/3/.yarn/berry/cache/@docusaurus-core-npm-3.6.3-a0940a712 c-10c0.zip/node_modules/@docusaurus/core/lib/webpack/templates/dev.html.template.ejs' in '/Users/[redacted]/Developer/website'
│
│ - child-compiler.js:211
│ [html-webpack-plugin-npm-5.6.3-57a7b18662-10c0.zip]/[html-webpack-plugin]/lib/child-compiler.js:211:18
│
│ - index.js:13681 finalCallback
│ [@rspack-core-npm-1.1.8-0093048ff4-10c0.zip]/[@rspack]/core/dist/index.js:13681:9
│
│ - index.js:13703
│ [@rspack-core-npm-1.1.8-0093048ff4-10c0.zip]/[@rspack]/core/dist/index.js:13703:14
│
│ - index.js:13805
│ [@rspack-core-npm-1.1.8-0093048ff4-10c0.zip]/[@rspack]/core/dist/index.js:13805:18
│
│ - index.js:473 done
│ [@rspack-lite-tapable-npm-1.0.1-a0c24b9689-10c0.zip]/[@rspack]/lite-tapable/dist/index.js:473:13
│
│ - index.js:480 AsyncSeriesHook.callAsyncStageRange
│ [@rspack-lite-tapable-npm-1.0.1-a0c24b9689-10c0.zip]/[@rspack]/lite-tapable/dist/index.js:480:20
│
│ - index.js:82 AsyncSeriesHook.callAsync
│ [@rspack-lite-tapable-npm-1.0.1-a0c24b9689-10c0.zip]/[@rspack]/lite-tapable/dist/index.js:82:21
│
│ - index.js:13801
│ [@rspack-core-npm-1.1.8-0093048ff4-10c0.zip]/[@rspack]/core/dist/index.js:13801:33
│
│ - index.js:13845
│ [@rspack-core-npm-1.1.8-0093048ff4-10c0.zip]/[@rspack]/core/dist/index.js:13845:37
│
│
client (Rspack 1.1.8) compiled with 8 errors

Your environment

  • Public source code:
  • Public site URL:
  • Docusaurus version used: 3.6.3
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Safari 17.5, Node.js 20.10
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): macOS Sonoma 14.5

Self-service

  • I'd be willing to fix this bug myself.

Activity

  1. added
    bug
    status: needs triage
    on Dec 21, 2024
  2. added
    external
    and removed
    status: needs triage
    on Dec 23, 2024
  3. slorber commented on Dec 23, 2024

    @slorber
    Collaborator

    This is a bug in Rspack, not Docusaurus

    Tracked here: web-infra-dev/rspack#2236

  4. slorber commented on Jan 17, 2025

    @slorber
    Collaborator

    Looks like Yarn PnP will be solved in Rspack v1.2 soon

    web-infra-dev/rspack#7639

  5. smeng9 commented on Jan 21, 2025

    @smeng9
    Author

    Rspack 1.2 is release now

  6. slorber commented on Jan 31, 2025

    @slorber
    Collaborator

    Tried using PnP on another website and still got errors with v1.2:

    easyops-cn/docusaurus-search-local#468 (comment)

  7. slorber commented on Mar 13, 2026

    @slorber
    Collaborator

    Going to reopen this because we still do not support Rspack + Yarn PnP

    Considering Docusaurus Faster is becoming the new default (#11802), this is annoying because our CI E2E tests fail under PnP

    To unlock this situation, I added the following fallback to Webpack, ensuring Yarn PnP users can still start/build their site, and also fixing our CI workflow temporarily.

      if (process.versions.pnp) {
        if (config.future.faster.rspackBundler) {
          logger.warn(`The Docusaurus bundler Rspack doesn't support the Yarn PnP linker yet.
    Your app will be built with Webpack instead of Rspack.
    See also https://github.com/facebook/docusaurus/issues/10787`);
          config.future.faster.rspackBundler = false;
          config.future.faster.rspackPersistentCache = false;
        }
      }

    For future self, here's how to run E2E tests locally for Yarn PnP:

    cd /Users/sebastienlorber/Desktop/projects/docusaurus
    rm -rf ../test-website
    rm -rf ~/.yarn/berry/cache/@docusaurus-*
    
    
    docker rm -f "verdaccio"
    yarn test:build:website -s && cd ../test-website
    
    
    yarn set version berry
    
    yarn config set nodeLinker pnp
    yarn config set npmRegistryServer http://localhost:4873
    yarn config set unsafeHttpWhitelist --json '["localhost"]'
    yarn config set enableGlobalCache true
    yarn config set pnpFallbackMode none
    
    yarn
    
    yarn start

    And here are the errors we get when trying to run Rspack + PnP:

    × Module not found: Can't resolve '@babel/runtime/helpers/esm/extends' in '/Users/sebastienlorber/.yarn/berry/cache/history-npm-4.10.1-ee217563ae-10c0.zip/node_modules/history/esm'
       ╭─[1:0]
     1 │ import _extends from '@babel/runtime/helpers/esm/extends';
       · ──────────────────────────────────────────────────────────
     2 │ import resolvePathname from 'resolve-pathname';
     3 │ import valueEqual from 'value-equal';
       ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'resolve-pathname' in '/Users/sebastienlorber/.yarn/berry/cache/history-npm-4.10.1-ee217563ae-10c0.zip/node_modules/history/esm'
       ╭─[2:0]
     1 │ import _extends from '@babel/runtime/helpers/esm/extends';
     2 │ import resolvePathname from 'resolve-pathname';
       · ───────────────────────────────────────────────
     3 │ import valueEqual from 'value-equal';
     4 │ import warning from 'tiny-warning';
       ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'value-equal' in '/Users/sebastienlorber/.yarn/berry/cache/history-npm-4.10.1-ee217563ae-10c0.zip/node_modules/history/esm'
       ╭─[3:0]
     1 │ import _extends from '@babel/runtime/helpers/esm/extends';
     2 │ import resolvePathname from 'resolve-pathname';
     3 │ import valueEqual from 'value-equal';
       · ─────────────────────────────────────
     4 │ import warning from 'tiny-warning';
     5 │ import invariant from 'tiny-invariant';
       ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'tiny-warning' in '/Users/sebastienlorber/.yarn/berry/cache/history-npm-4.10.1-ee217563ae-10c0.zip/node_modules/history/esm'
       ╭─[4:0]
     2 │ import resolvePathname from 'resolve-pathname';
     3 │ import valueEqual from 'value-equal';
     4 │ import warning from 'tiny-warning';
       · ───────────────────────────────────
     5 │ import invariant from 'tiny-invariant';
     6 │ 
       ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'tiny-invariant' in '/Users/sebastienlorber/.yarn/berry/cache/history-npm-4.10.1-ee217563ae-10c0.zip/node_modules/history/esm'
       ╭─[5:0]
     3 │ import valueEqual from 'value-equal';
     4 │ import warning from 'tiny-warning';
     5 │ import invariant from 'tiny-invariant';
       · ───────────────────────────────────────
     6 │ 
     7 │ function addLeadingSlash(path) {
       ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'react-is' in '/Users/sebastienlorber/.yarn/berry/cache/hoist-non-react-statics-npm-3.3.2-e7b709e6c1-10c0.zip/node_modules/hoist-non-react-statics/dist'
       ╭─[3:14]
     1 │ 'use strict';
     2 │ 
     3 │ var reactIs = require('react-is');
       ·               ───────────────────
     4 │ 
     5 │ /**
       ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'isarray' in '/Users/sebastienlorber/.yarn/berry/cache/path-to-regexp-npm-1.9.0-723549d8d9-10c0.zip/node_modules/path-to-regexp'
       ╭─[1:14]
     1 │ var isarray = require('isarray')
       ·               ──────────────────
     2 │ 
     3 │ /**
       ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'react-is' in '/Users/sebastienlorber/.yarn/berry/cache/prop-types-npm-15.8.1-17c71ee7ee-10c0.zip/node_modules/prop-types'
        ╭─[10:14]
      8 │ 'use strict';
      9 │ 
     10 │ var ReactIs = require('react-is');
        ·               ───────────────────
     11 │ var assign = require('object-assign');
     12 │ 
        ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'object-assign' in '/Users/sebastienlorber/.yarn/berry/cache/prop-types-npm-15.8.1-17c71ee7ee-10c0.zip/node_modules/prop-types'
        ╭─[11:13]
      9 │ 
     10 │ var ReactIs = require('react-is');
     11 │ var assign = require('object-assign');
        ·              ────────────────────────
     12 │ 
     13 │ var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
        ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'react-is' in '/Users/sebastienlorber/.yarn/berry/cache/prop-types-npm-15.8.1-17c71ee7ee-10c0.zip/node_modules/prop-types'
        ╭─[9:16]
      7 │ 
      8 │ if (process.env.NODE_ENV !== 'production') {
      9 │   var ReactIs = require('react-is');
        ·                 ───────────────────
     10 │ 
     11 │   // By explicitly using `prop-types` you are opting into new development behavior.
        ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'tslib' in '/Users/sebastienlorber/.yarn/berry/cache/@docusaurus-utils-common-npm-3.9.2-NEW-22732-f8438b9b5b-10c0.zip/node_modules/@docusaurus/utils-common/lib'
        ╭─[11:16]
      9 │ });
     10 │ exports.getErrorCausalChain = exports.removePrefix = exports.addSuffix = exports.removeSuffix = exports.addPrefix = exports.removeTrailingSlash = exports.addLeadingSlash = exports.addTrailingSlash = exports.applyTrailingSlash = exports.blogPostContainerID = void 0;
     11 │ const tslib_1 = require("tslib");
        ·                 ────────────────
     12 │ // __ prefix allows search crawlers (Algolia/DocSearch) to ignore anchors
     13 │ // https://github.com/facebook/docusaurus/issues/8883#issuecomment-1516328368
        ╰────
    client (Rspack 1.7.8) compiled with 22 errors
    ● Client ██████████████████████████████████████████████████ (100%) emitting after emit                                                                                                                             × Module not found: Can't resolve 'resolve-pathname' in '/Users/sebastienlorber/.yarn/berry/cache/history-npm-4.10.1-ee217563ae-10c0.zip/node_modules/history/esm'
       ╭─[2:0]
     1 │ import _extends from '@babel/runtime/helpers/esm/extends';
     2 │ import resolvePathname from 'resolve-pathname';
       · ───────────────────────────────────────────────
     3 │ import valueEqual from 'value-equal';
     4 │ import warning from 'tiny-warning';
       ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'value-equal' in '/Users/sebastienlorber/.yarn/berry/cache/history-npm-4.10.1-ee217563ae-10c0.zip/node_modules/history/esm'
       ╭─[3:0]
     1 │ import _extends from '@babel/runtime/helpers/esm/extends';
     2 │ import resolvePathname from 'resolve-pathname';
     3 │ import valueEqual from 'value-equal';
       · ─────────────────────────────────────
     4 │ import warning from 'tiny-warning';
     5 │ import invariant from 'tiny-invariant';
       ╰────
    
    --------------------------
    
    × Module not found: Can't resolve '@babel/runtime/helpers/esm/extends' in '/Users/sebastienlorber/.yarn/berry/cache/history-npm-4.10.1-ee217563ae-10c0.zip/node_modules/history/esm'
        ╭─[65:15]
     63 │   } else {
     64 │     // One-arg form: push(location)
     65 │     location = _extends({}, path);
        ·                ────────
     66 │     if (location.pathname === undefined) location.pathname = '';
     67 │ 
        ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'tiny-invariant' in '/Users/sebastienlorber/.yarn/berry/cache/history-npm-4.10.1-ee217563ae-10c0.zip/node_modules/history/esm'
         ╭─[250:55]
     248 │   }
     249 │ 
     250 │   !canUseDOM ? process.env.NODE_ENV !== "production" ? invariant(false, 'Browser history needs a DOM') : invariant(false) : void 0;
         ·                                                        ─────────
     251 │   var globalHistory = window.history;
     252 │   var canUseHistory = supportsHistory();
         ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'tiny-warning' in '/Users/sebastienlorber/.yarn/berry/cache/history-npm-4.10.1-ee217563ae-10c0.zip/node_modules/history/esm'
         ╭─[676:44]
     674 │ 
     675 │   function replace(path, state) {
     676 │     process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Hash history cannot replace state; it is ignored') : void 0;
         ·                                             ───────
     677 │     var action = 'REPLACE';
     678 │     var location = createLocation(path, undefined, undefined, history.location);
         ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'react-is' in '/Users/sebastienlorber/.yarn/berry/cache/hoist-non-react-statics-npm-3.3.2-e7b709e6c1-10c0.zip/node_modules/hoist-non-react-statics/dist'
       ╭─[3:14]
     1 │ 'use strict';
     2 │ 
     3 │ var reactIs = require('react-is');
       ·               ───────────────────
     4 │ 
     5 │ /**
       ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'isarray' in '/Users/sebastienlorber/.yarn/berry/cache/path-to-regexp-npm-1.9.0-723549d8d9-10c0.zip/node_modules/path-to-regexp'
       ╭─[1:14]
     1 │ var isarray = require('isarray')
       ·               ──────────────────
     2 │ 
     3 │ /**
       ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'react-is' in '/Users/sebastienlorber/.yarn/berry/cache/prop-types-npm-15.8.1-17c71ee7ee-10c0.zip/node_modules/prop-types'
        ╭─[10:14]
      8 │ 'use strict';
      9 │ 
     10 │ var ReactIs = require('react-is');
        ·               ───────────────────
     11 │ var assign = require('object-assign');
     12 │ 
        ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'object-assign' in '/Users/sebastienlorber/.yarn/berry/cache/prop-types-npm-15.8.1-17c71ee7ee-10c0.zip/node_modules/prop-types'
        ╭─[11:13]
      9 │ 
     10 │ var ReactIs = require('react-is');
     11 │ var assign = require('object-assign');
        ·              ────────────────────────
     12 │ 
     13 │ var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
        ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'react-is' in '/Users/sebastienlorber/.yarn/berry/cache/prop-types-npm-15.8.1-17c71ee7ee-10c0.zip/node_modules/prop-types'
        ╭─[9:16]
      7 │ 
      8 │ if (process.env.NODE_ENV !== 'production') {
      9 │   var ReactIs = require('react-is');
        ·                 ───────────────────
     10 │ 
     11 │   // By explicitly using `prop-types` you are opting into new development behavior.
        ╰────
    
    --------------------------
    
    × Module not found: Can't resolve 'tslib' in '/Users/sebastienlorber/.yarn/berry/cache/@docusaurus-utils-common-npm-3.9.2-NEW-22732-f8438b9b5b-10c0.zip/node_modules/@docusaurus/utils-common/lib'
        ╭─[11:16]
      9 │ });
     10 │ exports.getErrorCausalChain = exports.removePrefix = exports.addSuffix = exports.removeSuffix = exports.addPrefix = exports.removeTrailingSlash = exports.addLeadingSlash = exports.addTrailingSlash = exports.applyTrailingSlash = exports.blogPostContainerID = void 0;
     11 │ const tslib_1 = require("tslib");
        ·                 ────────────────
     12 │ // __ prefix allows search crawlers (Algolia/DocSearch) to ignore anchors
     13 │ // https://github.com/facebook/docusaurus/issues/8883#issuecomment-1516328368
        ╰────
    client (Rspack 1.7.8) compiled with 22 errors

    These are often related to legacy packages like react-is or prop-types. I have good hopes that in Docusaurus v4 this issue will eventually self-resolve 🤷‍♂️

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

    bugexternal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions