{"record":{"id":"34c49b3c9f128fd9","repo":"parcel-bundler/parcel","slug":"no-dynamic-require-possible-location","errorCode":null,"errorMessage":"No dynamic require possible: ${location}","messagePattern":"No dynamic require possible: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/workers/src/WorkerFarm.js","lineNumber":363,"sourceCode":"  }\n\n  async processRequest(\n    data: {|\n      location: FilePath,\n    |} & $Shape<WorkerRequest>,\n    worker?: Worker,\n  ): Promise<?string> {\n    let {method, args, location, awaitResponse, idx, handle: handleId} = data;\n    let mod;\n    if (handleId != null) {\n      mod = nullthrows(this.handles.get(handleId)?.fn);\n    } else if (location) {\n      // $FlowFixMe\n      if (process.browser) {\n        if (location === '@parcel/workers/src/bus.js') {\n          mod = (bus: any);\n        } else {\n          throw new Error('No dynamic require possible: ' + location);\n        }\n      } else {\n        // $FlowFixMe this must be dynamic\n        mod = require(location);\n      }\n    } else {\n      throw new Error('Unknown request');\n    }\n\n    const responseFromContent = (content: any): WorkerDataResponse => ({\n      idx,\n      type: 'response',\n      contentType: 'data',\n      content,\n    });\n\n    const errorResponseFromError = (e: Error): WorkerErrorResponse => ({\n      idx,","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/workers/src/WorkerFarm.js#L345-L381","documentation":"Thrown inside WorkerFarm's call dispatcher when process.browser is true and an incoming worker request references a module location other than '@parcel/workers/src/bus.js'. Because the browser cannot perform dynamic require(), only the bundled bus module is reachable; any other requested location is rejected.","triggerScenarios":"A worker call (via createHandle/run) is dispatched in a browser bundle where data.location points to a module that is neither the bundled bus nor reachable through a handleId. Happens when a Parcel plugin requests a worker module not bundled for the browser.","commonSituations":"Running Parcel's plugin pipeline in a browser build; a plugin that registers a worker-side request pointing to a Node-only module; misconfigured web worker backend.","solutions":["Ensure plugins used in browser builds only reference modules bundled for the browser.","Prefer handleId-based calls (registered handles) so no dynamic require is needed.","Bundle the required module under '@parcel/workers/src/bus.js' alias, or avoid the worker dispatch path in the browser.","Run the build in Node where dynamic require is allowed."],"exampleFix":"// before — browser dispatch hits a Node-only location\ncall({ location: '@parcel/core/src/worker.js', ... })\n\n// after — use a registered handle\ncall({ handle: registeredHandleId, ... })","handlingStrategy":"validation","validationCode":"if (process.browser && location && location !== '@parcel/workers/src/bus.js') {\n  throw new Error(`Cannot require '${location}' in a browser worker; use a registered handle.`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use handleId-based dispatch in browser builds to avoid dynamic require.","Bundle any worker-side module under the expected browser alias.","Keep plugin worker requests on Node, not in browser pipelines."],"tags":["worker-farm","browser","dynamic-require","dispatch"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}