{"record":{"id":"851224e2edfefb30","repo":"facebook/docusaurus","slug":"to-enable-docusaurus-faster-options-your-site-mus","errorCode":null,"errorMessage":"To enable Docusaurus Faster options, your site must add the ${logger.name('@docusaurus/faster')} package as a dependency.","messagePattern":"To enable Docusaurus Faster options, your site must add the (.+?) package as a dependency\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-bundler/src/importFaster.ts","lineNumber":25,"sourceCode":"\nimport logger from '@docusaurus/logger';\nimport type {\n  MinimizerOptions as JsMinimizerOptions,\n  CustomOptions,\n} from 'terser-webpack-plugin';\nimport type {MinimizerOptions as CssMinimizerOptions} from 'css-minimizer-webpack-plugin';\n\nexport type FasterModule = Awaited<typeof import('@docusaurus/faster')>;\n\nasync function importFaster(): Promise<FasterModule> {\n  return import('@docusaurus/faster');\n}\n\nasync function ensureFaster(): Promise<FasterModule> {\n  try {\n    return await importFaster();\n  } catch (error) {\n    throw new Error(\n      `To enable Docusaurus Faster options, your site must add the ${logger.name(\n        '@docusaurus/faster',\n      )} package as a dependency.`,\n      {cause: error},\n    );\n  }\n}\n\nexport async function importRspack(): Promise<FasterModule['rspack']> {\n  const faster = await ensureFaster();\n  return faster.rspack;\n}\n\nexport async function importSwcLoader(): Promise<string> {\n  const faster = await ensureFaster();\n  return faster.swcLoader;\n}\n","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-bundler/src/importFaster.ts#L7-L43","documentation":"Thrown by ensureFaster() in @docusaurus/bundler when a Docusaurus Faster feature is requested (Rspack, SWC loader, SWC/HTML/CSS minimizers) but the dynamic import('@docusaurus/faster') fails. @docusaurus/faster is an optional peer dependency: it must be installed by the site to use any future.faster option, and this guard turns the cryptic MODULE_NOT_FOUND into an actionable message.","triggerScenarios":"Setting future.faster.swcJsLoader = true, future.faster.rspack = true, or htmlMinifier/swc minimizer options without having run npm install @docusaurus/faster; the package is in devDependencies but the install was skipped; a monorepo hoisting issue where the package is not resolvable from the bundler.","commonSituations":"Following a guide that enables Faster options without the install step; copying a docusaurus.config from another project that had @docusaurus/faster but forgetting its dependency; upgrading Docusaurus to a version that split faster into its own package; pnpm strict-hoisting hiding the package.","solutions":["Install the package with your manager: npm install @docusaurus/faster (or yarn/pnpm/bun add).","Confirm it resolves: ls node_modules/@docusaurus/faster and check package.json dependencies contains it.","For pnpm, ensure no shamefully-hoist=false block hides it; add it explicitly to the workspace package that builds the site.","If you did not mean to use Faster, remove the future.faster flags from docusaurus.config."],"exampleFix":"// before (docusaurus.config.ts)\nfuture: { faster: { swcJsLoader: true } }\n// after (shell)\nnpm install @docusaurus/faster","handlingStrategy":"validation","validationCode":"import {existsSync} from 'node:fs';\nimport {createRequire} from 'node:module';\nconst require = createRequire(import.meta.url);\nfunction fasterIsInstalled(): boolean {\n  try { require.resolve('@docusaurus/faster'); return true; }\n  catch { return false; }\n}\n// before enabling future.faster, assert fasterIsInstalled()","typeGuard":"const hasFaster = (): boolean => {\n  try { require.resolve('@docusaurus/faster'); return true; } catch { return false; }\n};","tryCatchPattern":null,"preventionTips":["Always pair future.faster.* flags with `npm install @docusaurus/faster`.","Add a postinstall check that fails CI if faster flags are set but the package is missing.","In pnpm workspaces, declare @docusaurus/faster in the site package, not just the root."],"tags":["bundler","faster","dependency","optional-peer"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}