zellij-org/zellij · error
module '{}' referenced at {} is not part of the bundle
Error message
module '{}' referenced at {} is not part of the bundle What it means
The specifier parsed to `./name.js`, but `name` is not listed in MODULE_ORDER (xtask/src/assets.rs), so the bundle would reference code that is never concatenated. Only imports targeting one of the registered sibling modules are allowed.
Source
Thrown at xtask/src/assets.rs:248
.map(|(_, specifier)| specifier)
.ok_or_else(|| anyhow!("missing module specifier at {}", location))?
.trim()
.trim_end_matches(';')
.trim_matches(|c| c == '"' || c == '\'');
let name = specifier
.strip_prefix("./")
.and_then(|name| name.strip_suffix(".js"))
.ok_or_else(|| {
anyhow!(
"only relative sibling module specifiers are supported, found '{}' at {}",
specifier,
location
)
})?;
if !MODULE_ORDER.contains(&name) {
return Err(anyhow!(
"module '{}' referenced at {} is not part of the bundle",
name,
location
));
}
Ok(())
}
fn top_level_declarations(chunk: &str) -> Vec<String> {
let mut names = Vec::new();
for line in chunk.lines() {
if line.starts_with(char::is_whitespace) {
continue;
}
for prefix in DECLARATION_PREFIXES {
let Some(rest) = line.strip_prefix(prefix) else {
continue;
};View on GitHub (pinned to 98a0837077)
Solutions
- Add the module name to MODULE_ORDER in xtask/src/assets.rs — order matters, dependencies must come before importers
- Or import the functionality from an existing bundled module instead of creating a new file
- If you renamed a module, update both the file's importers and MODULE_ORDER in the same change
Example fix
// before: xtask/src/assets.rs const MODULE_ORDER: &[&str] = &["utils", /* ... */]; // importing './helpers.js' fails // after const MODULE_ORDER: &[&str] = &["utils", "helpers", /* ... */];
Defensive patterns
Strategy: validation
Validate before calling
# every ./x.js specifier must match a name in MODULE_ORDER
MODULES="utils connection auth keyboard links terminal ime-bypass soft-keyboard key-handler mouse pinch mobile-pan touch input mobile-ui websockets index"
for spec in $(grep -hoE "from ['\"]\./[^'\"]+\.js['\"]" zellij-client/assets/*.js | sed -E "s/from ['\"]\.\/([^'\"]+)\.js['\"]/\1/" | sort -u); do
echo " $MODULES " | grep -q " $spec " || { echo "module '$spec' not in MODULE_ORDER"; exit 1; }
done Type guard
const MODULE_ORDER: &[&str] = &[/* same list as xtask/src/assets.rs */];
fn module_is_bundled(specifier: &str) -> bool {
specifier
.strip_prefix("./")
.and_then(|s| s.strip_suffix(".js"))
.is_some_and(|name| MODULE_ORDER.contains(&name))
} Prevention
- When adding a module file, register it in MODULE_ORDER in the same commit (dependencies before importers)
- When renaming a module, update importers and MODULE_ORDER together
- The pre-flight loop above catches this before the slower full bundling run
When it happens
Trigger: Creating a new file helpers.js in zellij-client/assets and importing it as './helpers.js' without adding 'helpers' to MODULE_ORDER; renaming a module file without updating MODULE_ORDER.
Common situations: Adding a new frontend module during feature work; refactors that rename module files; scratch files accidentally imported.
Related errors
- duplicate top-level identifier '{}' declared in both '{}.js'
- dynamic import is not supported at {}
- unrecognised import syntax at {}
- unterminated import statement at {}
- unrecognised export syntax at {}
AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16).
Data as JSON: /api/errors/307b53ce720912c3.
Report an issue: GitHub.