rollup/rollup · error
You must supply options.input to rollup
Error message
You must supply options.input to rollup
What it means
During `Graph.build`, Rollup resolves all configured entries through the module loader. If the resulting `entryModules` array is empty (no input resolved to an actual module), the build cannot proceed and throws. This happens after `addEntryPlugins`/input resolution, so even input plugins must produce at least one entry.
Source
Thrown at src/Graph.ts:154
}
return {
modules: this.modules.map(module => module.toJSON()),
plugins: this.pluginCache
};
}
getModuleInfo = (moduleId: string): ModuleInfo | null => {
const foundModule = this.modulesById.get(moduleId);
if (!foundModule) return null;
return foundModule.info;
};
private async generateModuleGraph(): Promise<void> {
({ entryModules: this.entryModules, implicitEntryModules: this.implicitEntryModules } =
await this.moduleLoader.addEntryModules(normalizeEntryModules(this.options.input), true));
if (this.entryModules.length === 0) {
throw new Error('You must supply options.input to rollup');
}
for (const module of this.modulesById.values()) {
module.cacheInfoGetters();
if (module instanceof Module) {
this.modules.push(module);
} else {
this.externalModules.push(module);
}
}
}
private includeStatements(): void {
const entryModules = [...this.entryModules, ...this.implicitEntryModules];
for (const module of entryModules) {
markModuleAndImpureDependenciesAsExecuted(module);
}
if (this.options.treeshake) {
let treeshakingPass = 1;View on GitHub (pinned to ddc4ffab62)
Solutions
- Set `input` to a file path, glob, array, or object that matches at least one existing file.
- Verify your input plugin actually emits entries (check its `options` hook).
- Ensure entries are not marked external or excluded by a filter.
- Log the resolved input right before calling rollup() to catch empty sets.
Example fix
// before
await rollup({ plugins: [...] });
// after
await rollup({ input: 'src/main.js', plugins: [...] }); Defensive patterns
Strategy: validation
Validate before calling
// Ensure input resolves to at least one entry before calling rollup().
function hasEntries(input) {
if (!input) return false;
if (typeof input === 'string') return input.length > 0;
if (Array.isArray(input)) return input.length > 0;
if (typeof input === 'object') return Object.keys(input).length > 0;
return false;
}
if (!hasEntries(options.input)) {
throw new Error('options.input did not resolve to any entries');
} Type guard
// Narrow an unknown input config to a non-empty entry descriptor.
function isNonEmptyInput(input) {
return typeof input === 'string' && input.length > 0
|| (Array.isArray(input) && input.length > 0)
|| (!!input && typeof input === 'object' && Object.keys(input).length > 0);
} Prevention
- Always set options.input explicitly.
- Verify glob results are non-empty before passing them as input.
- Log the resolved input set in debug builds to catch silent drops.
- Make sure input plugins actually emit entries via their options hook.
When it happens
Trigger: Omitting `input`; passing `input: []`; an input glob/array that matched zero files; an input plugin that emits no entries; all entries being resolved as external or filtered out.
Common situations: Dynamic configs that produce empty input sets, misconfigured `@rollup/plugin-multi-entry`, typos in entry paths that get silently dropped, conditional configs that leave input unset.
Related errors
- You must supply an options object to rollup
- Invalid --plugin argument format: ${JSON.stringify(pluginTex
- You must supply an options object
- Cannot import the generated bundle
AI-assisted analysis of rollup/rollup@ddc4ffab62 (2026-08-03).
Data as JSON: /data/errors/eb9a67febf5ca06c.json.
Report an issue: GitHub.