parcel-bundler/parcel · error · Error
Plugin ${pluginName} has no exports.
Error message
Plugin ${pluginName} has no exports. What it means
After requiring the plugin module, Parcel unwraps `default` if present and then checks truthiness. If the resolved export is falsy (empty module, `null`/`undefined` default, or a module that failed to assign exports), there is no plugin object to invoke and Parcel rejects it.
Source
Thrown at packages/core/core/src/loadParcelPlugin.js:232
codeHighlights: generateJSONCodeHighlights(pkgContents, [
{
key: '/engines/parcel',
},
]),
},
],
},
});
}
}
}
let plugin = await options.packageManager.require(pluginName, resolveFrom, {
shouldAutoInstall: options.shouldAutoInstall,
});
plugin = plugin.default ? plugin.default : plugin;
if (!plugin) {
throw new Error(`Plugin ${pluginName} has no exports.`);
}
plugin = plugin[CONFIG];
if (!plugin) {
throw new Error(
`Plugin ${pluginName} is not a valid Parcel plugin, should export an instance of a Parcel plugin ex. "export default new Reporter({ ... })".`,
);
}
return {
plugin,
version: nullthrows(pkg).version,
resolveFrom: toProjectPath(options.projectRoot, resolveFrom),
range,
};
}
View on GitHub (pinned to 59484858a1)
Solutions
- Ensure the plugin module has a default export that is a Parcel plugin instance.
- Check the plugin's `main`/`exports` field in package.json resolves to the right file.
- Rebuild/republish the plugin if its dist artifact is empty.
Example fix
// before
export const transform = () => {}; // no default
// after
import {Transformer} from '@parcel/plugin';
export default new Transformer({ async transform({asset}) { return [asset]; } }); Defensive patterns
Strategy: type-guard
Validate before calling
// After requiring the plugin, assert a truthy export exists.
const mod = await require(name);
const exp = mod.default ?? mod;
if (!exp) throw new Error(`${name} has no default export`); Type guard
function hasTruthyExport(mod: any): boolean {
const exp = mod?.default ?? mod;
return Boolean(exp);
} Prevention
- Always `export default new Reporter({...})` in plugins.
- Verify the package.json `main`/`exports` field after building the plugin.
- Smoke-test the plugin's default export in CI.
When it happens
Trigger: The required plugin module exports nothing (or a falsy default export).
Common situations: Plugin build emitted an empty bundle; plugin's main entry points at the wrong file; plugin authored with named exports only and no default.
Related errors
- Plugin ${pluginName} is not a valid Parcel plugin, should ex
- Bundle is not inline and unable to retrieve contents
- Asset has an AST but no generate method is available on the
- ${pluginName} does not have a generate method
- Local plugins are not supported in Parcel config packages. P
AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13).
Data as JSON: /api/errors/b73b96274d773c51.
Report an issue: GitHub.