vercel/next.js · error
Complex patterns into wildcard exports fields are not implem
Error message
Complex patterns into wildcard exports fields are not implemented yet: {} into '{}*{}' What it means
During package `exports`/`imports` wildcard resolution, Turbopack matches an import request against a template containing `*`. The implemented matcher handles constant prefixes, a single dynamic segment, and constant suffixes. When the request pattern is more complex (e.g. multiple interleaved dynamic segments) and cannot be conclusively matched or rejected, the resolver refuses to guess and emits this 'not implemented yet' error to avoid producing an incorrect resolution.
Source
Thrown at turbopack/crates/turbopack-core/src/resolve/alias_map.rs:552
// `require('@/foo/' + dyn)` into a `@/*` mapping
req_prefix.starts_with(&**prefix)
} else if let Pattern::Concatenation(req) = self.request
&& let [
Pattern::Constant(req_prefix),
Pattern::Dynamic | Pattern::DynamicNoSlash,
Pattern::Constant(req_suffix),
] = req.as_slice()
{
req_prefix.starts_with(&**prefix) && req_suffix.ends_with(&**suffix)
} else if !self.request.could_match(prefix) {
// There's no way it could match if the prefix can't match.
false
} else if suffix.is_empty() {
// Prefix matches the request, and suffix is empty.
true
} else {
// It may or may not match, throw an error.
return Some(Err(anyhow::anyhow!(
"Complex patterns into wildcard exports fields are not \
implemented yet: {} into '{}*{}'",
self.request.describe_as_string(),
prefix,
suffix,
)));
};
if is_match {
let mut remaining = self.request.clone();
if let Err(e) = remaining.strip_prefix_len(prefix.len()) {
return Some(Err(e.context(self.request.describe_as_string())));
}
remaining.strip_suffix_len(suffix.len());
let output = template.replace(&remaining);
return Some(Ok(AliasMatch {
prefix: prefix.clone(),View on GitHub (pinned to 0ae8c72462)
Solutions
- Simplify the exports/paths mapping so each wildcard maps a single dynamic segment (e.g. `"@/*": ["./src/*"]`).
- Replace the dynamic-specifier concatenation with a fully-static import so the constant-pattern fast path applies.
- Add an explicit, more specific mapping for the complex case so the wildcard fallback is never reached.
- File an issue against turbopack with the exact exports field and import pattern; as a workaround, resolve the module outside the wildcard mapping.
Example fix
// before: package.json exports
"exports": { "./features/*": "./dist/features/*" }
// import: require('./features/' + a + '/shared/' + b)
// after: add explicit static entries
"exports": {
"./features/*/shared/*": "./dist/features/*/shared/*"
} Defensive patterns
Strategy: validation
Validate before calling
// Before relying on a wildcard exports/paths mapping with dynamic imports,
// confirm the request is a single-segment dynamic specifier.
function isSimpleDynamicRequest(req) {
// single '*' expansion only: prefix + one dynamic + optional suffix
const starCount = (req.match(/\*/g) || []).length;
return starCount <= 1;
}
if (!isSimpleDynamicRequest(myMapping)) {
throw new Error('mapping too complex for Turbopack wildcard resolution');
} Prevention
- Keep tsconfig `paths` and package.json `exports` wildcards to a single `*` per template.
- Avoid concatenating multiple dynamic fragments into a single import specifier that hits a wildcard.
- Add static fallback mappings for complex cases you know the resolver can't handle.
When it happens
Trigger: A package.json `exports` or tsconfig `paths` entry with a `*` wildcard combined with a dynamic import whose request pattern is a concatenation beyond a single dynamic segment (e.g. prefix + dynamic + middle-constant + dynamic). The matcher reaches the fallback arm at alias_map.rs:551 where it cannot prove a match.
Common situations: Complex path-mapping configs (tsconfig `paths` with multiple wildcards, package `exports` with nested patterns) consumed by code that builds import specifiers dynamically; aliasing schemes ported from webpack that rely on resolver behaviors Turbopack hasn't implemented yet.
AI-assisted analysis of vercel/next.js@0ae8c72462 (2026-08-06).
Data as JSON: /api/errors/728317fd8df1ce1e.
Report an issue: GitHub.