{"record":{"id":"81c35df77ee911c7","repo":"facebook/docusaurus","slug":"you-can-t-use-siteconfig-webpack-jsloader-and-site","errorCode":null,"errorMessage":"You can't use siteConfig.webpack.jsLoader and siteConfig.future.faster.swcJsLoader at the same time.\nTo avoid any configuration ambiguity, you must make an explicit choice:\n- If you want to use Docusaurus Faster and SWC (recommended), remove siteConfig.webpack.jsLoader\n- If you want to use a custom JS loader, use siteConfig.future.faster.swcJsLoader: false","messagePattern":"You can't use siteConfig\\.webpack\\.jsLoader and siteConfig\\.future\\.faster\\.swcJsLoader at the same time\\.\nTo avoid any configuration ambiguity, you must make an explicit choice:\n- If you want to use Docusaurus Faster and SWC \\(recommended\\), remove siteConfig\\.webpack\\.jsLoader\n- If you want to use a custom JS loader, use siteConfig\\.future\\.faster\\.swcJsLoader: false","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-bundler/src/loaders/jsLoader.ts","lineNumber":67,"sourceCode":"\n// Confusing: function that creates a function that creates actual js loaders\n// This is done on purpose because the js loader factory is a public API\n// It is injected in configureWebpack plugin lifecycle for plugin authors\nexport async function createJsLoaderFactory({\n  siteConfig,\n}: {\n  siteConfig: {\n    webpack?: DocusaurusConfig['webpack'];\n    future: {\n      faster: DocusaurusConfig['future']['faster'];\n    };\n  };\n}): Promise<ConfigureWebpackUtils['getJSLoader']> {\n  const currentBundler = await getCurrentBundler({siteConfig});\n  const isSWCLoader = siteConfig.future.faster.swcJsLoader;\n  if (isSWCLoader) {\n    if (siteConfig.webpack?.jsLoader) {\n      throw new Error(\n        `You can't use siteConfig.webpack.jsLoader and siteConfig.future.faster.swcJsLoader at the same time.\nTo avoid any configuration ambiguity, you must make an explicit choice:\n- If you want to use Docusaurus Faster and SWC (recommended), remove siteConfig.webpack.jsLoader\n- If you want to use a custom JS loader, use siteConfig.future.faster.swcJsLoader: false`,\n      );\n    }\n    return currentBundler.name === 'rspack'\n      ? createRspackSwcJsLoaderFactory()\n      : createSwcJsLoaderFactory();\n  }\n\n  const jsLoader = siteConfig.webpack?.jsLoader ?? 'babel';\n  if (jsLoader instanceof Function) {\n    return ({isServer}) => jsLoader(isServer);\n  }\n  if (jsLoader === 'babel') {\n    return BabelJsLoaderFactory;\n  }","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-bundler/src/loaders/jsLoader.ts#L49-L85","documentation":"Thrown by createJsLoaderFactory() in @docusaurus/bundler when the site enables both siteConfig.future.faster.swcJsLoader AND a custom siteConfig.webpack.jsLoader. The two are mutually exclusive because Docusaurus cannot decide which JS pipeline to use, so it refuses to pick silently and asks the user to make an explicit choice.","triggerScenarios":"In docusaurus.config, setting future.faster.swcJsLoader = true while also providing a custom webpack: { jsLoader: ... } function or value; copying a config that had a custom jsLoader and then flipping the faster.swcJsLoader flag on.","commonSituations":"Adopting Docusaurus Faster on a site that previously had a custom Babel/SWC jsLoader; enabling faster.swcJsLoader during a migration but forgetting to delete the old custom loader.","solutions":["If you want Faster + SWC (recommended): remove the siteConfig.webpack.jsLoader entry.","If you want to keep your custom JS loader: set siteConfig.future.faster.swcJsLoader = false (or leave the faster block off)."],"exampleFix":"// before\nwebpack: { jsLoader: (isServer) => ({ loader: 'babel-loader', options }) },\nfuture: { faster: { swcJsLoader: true } }\n// after (use SWC via Faster)\n// webpack: { jsLoader: ... }   <-- removed\nfuture: { faster: { swcJsLoader: true } }","handlingStrategy":"validation","validationCode":"function assertNoLoaderConflict(cfg: {webpack?: {jsLoader?: unknown}; future?: {faster?: {swcJsLoader?: boolean}}}) {\n  if (cfg.future?.faster?.swcJsLoader && cfg.webpack?.jsLoader !== undefined) {\n    throw new Error('Remove siteConfig.webpack.jsLoader when future.faster.swcJsLoader is true.');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat faster.swcJsLoader and webpack.jsLoader as mutually exclusive in config reviews.","When migrating to Faster, delete the custom jsLoader in the same commit.","Add a config-self-check plugin that asserts the two are never both set."],"tags":["bundler","faster","config","swc","conflict"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}