{"record":{"id":"79c8dbc5e6c5384c","repo":"parcel-bundler/parcel","slug":"no-dynamic-require-possible-module","errorCode":null,"errorMessage":"No dynamic require possible: ${module}","messagePattern":"No dynamic require possible: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/workers/src/child.js","lineNumber":109,"sourceCode":"  messageListener(message: WorkerMessage): Async<void> {\n    if (message.type === 'response') {\n      return this.handleResponse(message);\n    } else if (message.type === 'request') {\n      return this.handleRequest(message);\n    }\n  }\n\n  send(data: WorkerMessage): void {\n    this.child.send(data);\n  }\n\n  async childInit(module: string, childId: number): Promise<void> {\n    // $FlowFixMe\n    if (process.browser) {\n      if (module === '@parcel/core/src/worker.js') {\n        this.module = coreWorker;\n      } else {\n        throw new Error('No dynamic require possible: ' + module);\n      }\n    } else {\n      // $FlowFixMe this must be dynamic\n      this.module = require(module);\n    }\n    this.childId = childId;\n\n    if (this.module.childInit != null) {\n      await this.module.childInit();\n    }\n  }\n\n  async handleRequest(data: WorkerRequest): Promise<void> {\n    let {idx, method, args, handle: handleId} = data;\n    let child = nullthrows(data.child);\n\n    const responseFromContent = (content: any): WorkerDataResponse => ({\n      idx,","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/workers/src/child.js#L91-L127","documentation":"Thrown by Child.childInit when process.browser is true and the requested module is not '@parcel/core/src/worker.js'. In a browser bundle dynamic require() is impossible, so only the pre-bundled coreWorker reference is permitted; any other module name is rejected.","triggerScenarios":"Initializing a worker child in a browser build with a module string other than the bundled core worker — e.g. a plugin that tries to load its own worker module in a browser context.","commonSituations":"Browser/web worker Parcel integrations; misconfigured bundling that includes the child worker code; plugins assuming Node dynamic require works in the browser.","solutions":["In browser builds, only request '@parcel/core/src/worker.js' as the child module.","Bundle any required plugin worker under that module id, or move the work to a handle-based call.","Run Parcel in Node where require(module) works for arbitrary modules."],"exampleFix":"// before (browser)\nchild.childInit('./myPluginWorker.js', 0);\n\n// after\nchild.childInit('@parcel/core/src/worker.js', 0);","handlingStrategy":"validation","validationCode":"if (process.browser && module !== '@parcel/core/src/worker.js') {\n  throw new Error(`Browser child init requires the core worker module, got ${module}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In browser builds, only initialize the child with '@parcel/core/src/worker.js'.","Bundle any plugin worker logic under that id or use handles.","Keep arbitrary module child init on Node."],"tags":["worker-farm","browser","dynamic-require","child"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}