fix(turbopack): add list of packages that should never be marked as e… (#59020)
### What?
Turbopack was missing the list of modules / requests that should never
be marked as external:
8d1c619ad6/packages/next/src/build/handle-externals.ts (L188)
This could lead to errors with i.e. `next/image` not receiving the
correct image config.
Closes PACK-2047
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
parent
f4c14935aa
commit
9c79186610
1 changed files with 9 additions and 1 deletions
|
@ -80,7 +80,15 @@ impl ResolvePlugin for ExternalCjsModulesResolvePlugin {
|
|||
if *condition(self.root).matches(context).await? {
|
||||
return Ok(ResolveResultOption::none());
|
||||
}
|
||||
if !matches!(&*request.await?, Request::Module { .. }) {
|
||||
let request_value = &*request.await?;
|
||||
if !matches!(request_value, Request::Module { .. }) {
|
||||
return Ok(ResolveResultOption::none());
|
||||
}
|
||||
|
||||
// from https://github.com/vercel/next.js/blob/8d1c619ad650f5d147207f267441caf12acd91d1/packages/next/src/build/handle-externals.ts#L188
|
||||
let never_external_regex = lazy_regex::regex!("^(?:private-next-pages\\/|next\\/(?:dist\\/pages\\/|(?:app|document|link|image|legacy\\/image|constants|dynamic|script|navigation|headers|router)$)|string-hash|private-next-rsc-action-validate|private-next-rsc-action-client-wrapper|private-next-rsc-action-proxy$)");
|
||||
|
||||
if never_external_regex.is_match(&request_value.request().unwrap_or_default()) {
|
||||
return Ok(ResolveResultOption::none());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue