{"record":{"id":"728317fd8df1ce1e","repo":"vercel/next.js","slug":"complex-patterns-into-wildcard-exports-fields-are","errorCode":null,"errorMessage":"Complex patterns into wildcard exports fields are not implemented yet: {} into '{}*{}'","messagePattern":"Complex patterns into wildcard exports fields are not implemented yet: (.+?) into '(.+?)\\*(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"turbopack/crates/turbopack-core/src/resolve/alias_map.rs","lineNumber":552,"sourceCode":"                            // `require('@/foo/' + dyn)` into a `@/*` mapping\n                            req_prefix.starts_with(&**prefix)\n                        } else if let Pattern::Concatenation(req) = self.request\n                            && let [\n                                Pattern::Constant(req_prefix),\n                                Pattern::Dynamic | Pattern::DynamicNoSlash,\n                                Pattern::Constant(req_suffix),\n                            ] = req.as_slice()\n                        {\n                            req_prefix.starts_with(&**prefix) && req_suffix.ends_with(&**suffix)\n                        } else if !self.request.could_match(prefix) {\n                            // There's no way it could match if the prefix can't match.\n                            false\n                        } else if suffix.is_empty() {\n                            // Prefix matches the request, and suffix is empty.\n                            true\n                        } else {\n                            // It may or may not match, throw an error.\n                            return Some(Err(anyhow::anyhow!(\n                                \"Complex patterns into wildcard exports fields are not \\\n                                 implemented yet: {} into '{}*{}'\",\n                                self.request.describe_as_string(),\n                                prefix,\n                                suffix,\n                            )));\n                        };\n\n                        if is_match {\n                            let mut remaining = self.request.clone();\n                            if let Err(e) = remaining.strip_prefix_len(prefix.len()) {\n                                return Some(Err(e.context(self.request.describe_as_string())));\n                            }\n                            remaining.strip_suffix_len(suffix.len());\n\n                            let output = template.replace(&remaining);\n                            return Some(Ok(AliasMatch {\n                                prefix: prefix.clone(),","sourceCodeStart":534,"sourceCodeEnd":570,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/turbopack/crates/turbopack-core/src/resolve/alias_map.rs#L534-L570","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: package.json exports\n\"exports\": { \"./features/*\": \"./dist/features/*\" }\n// import: require('./features/' + a + '/shared/' + b)\n\n// after: add explicit static entries\n\"exports\": {\n  \"./features/*/shared/*\": \"./dist/features/*/shared/*\"\n}","handlingStrategy":"validation","validationCode":"// Before relying on a wildcard exports/paths mapping with dynamic imports,\n// confirm the request is a single-segment dynamic specifier.\nfunction isSimpleDynamicRequest(req) {\n  // single '*' expansion only: prefix + one dynamic + optional suffix\n  const starCount = (req.match(/\\*/g) || []).length;\n  return starCount <= 1;\n}\n\nif (!isSimpleDynamicRequest(myMapping)) {\n  throw new Error('mapping too complex for Turbopack wildcard resolution');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["resolve","exports","wildcard","alias","not-implemented"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}