parcel-bundler/parcel · error · Error
No dynamic require possible: ${location}
Error message
No dynamic require possible: ${location} What it means
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.
Source
Thrown at packages/core/workers/src/WorkerFarm.js:363
}
async processRequest(
data: {|
location: FilePath,
|} & $Shape<WorkerRequest>,
worker?: Worker,
): Promise<?string> {
let {method, args, location, awaitResponse, idx, handle: handleId} = data;
let mod;
if (handleId != null) {
mod = nullthrows(this.handles.get(handleId)?.fn);
} else if (location) {
// $FlowFixMe
if (process.browser) {
if (location === '@parcel/workers/src/bus.js') {
mod = (bus: any);
} else {
throw new Error('No dynamic require possible: ' + location);
}
} else {
// $FlowFixMe this must be dynamic
mod = require(location);
}
} else {
throw new Error('Unknown request');
}
const responseFromContent = (content: any): WorkerDataResponse => ({
idx,
type: 'response',
contentType: 'data',
content,
});
const errorResponseFromError = (e: Error): WorkerErrorResponse => ({
idx,View on GitHub (pinned to 59484858a1)
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.
Example fix
// before — browser dispatch hits a Node-only location
call({ location: '@parcel/core/src/worker.js', ... })
// after — use a registered handle
call({ handle: registeredHandleId, ... }) Defensive patterns
Strategy: validation
Validate before calling
if (process.browser && location && location !== '@parcel/workers/src/bus.js') {
throw new Error(`Cannot require '${location}' in a browser worker; use a registered handle.`);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No dynamic require possible: ${workerPath}
- No dynamic require possible: ${module}
- IDBCache is only supported in the browser
- Supplied WorkerFarm is ending
- More than one target is not supported in serve mode
AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13).
Data as JSON: /api/errors/34c49b3c9f128fd9.
Report an issue: GitHub.