Unverified Commit 861b472b authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

fix layout segment key to match up with manifest (#60783)

### What?

When webpack loaders are applied on a page file and it's renamed with
the `as` key, layout segment key no longer matches. This fixes that

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes PACK-2251
parent 72e381c8
......@@ -107,6 +107,15 @@ impl LoaderTreeBuilder {
let i = self.unique_number();
let identifier = magic_identifier::mangle(&format!("{name} #{i}"));
let source = Vc::upcast(FileSource::new(component));
let reference_ty = Value::new(ReferenceType::EcmaScriptModules(
EcmaScriptModulesReferenceSubType::Undefined,
));
let module = self
.server_component_transition
.process(source, self.context, reference_ty)
.module();
match self.mode {
NextMode::Development => {
let chunks_identifier =
......@@ -131,7 +140,7 @@ impl LoaderTreeBuilder {
self.loader_tree_code,
" {name}: [() => {identifier}, {path}],",
name = StringifyJs(name),
path = StringifyJs(&component.to_string().await?)
path = StringifyJs(&module.ident().path().to_string().await?)
)?;
self.imports.push(formatdoc!(
......@@ -144,16 +153,6 @@ impl LoaderTreeBuilder {
}
}
let source = Vc::upcast(FileSource::new(component));
let reference_ty = Value::new(ReferenceType::EcmaScriptModules(
EcmaScriptModulesReferenceSubType::Undefined,
));
let module = self
.server_component_transition
.process(source, self.context, reference_ty)
.module();
self.inner_assets.insert(format!("COMPONENT_{i}"), module);
}
Ok(())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment