fix(next-core): align edge chunking context's asset root (#57022)
### What? If there's a static asset with edge runtime config, turbopack will bail with ``` ⨯ ModuleBuildError: Code generation for chunk item errored An error occurred while generating the chunk item [project]/test/e2e/app-dir/metadata/app/icon.svg (static, edge rsc) Caused by: - expected output_root to contain asset path Debug info: - An error occurred while generating the chunk item [project]/test/e2e/app-dir/metadata/app/icon.svg (static, edge rsc) - Execution of <DevChunkingContext as ChunkingContext>::asset_url failed - expected output_root to contain asset path ``` Since we creates chunking context for the edge with different output_root and asset_root, by using asset_root to be client_root. The other places creating context with `DevChunkingContext` don't do this, PR simply adjusting root to be output_root. For the server's chunking context it actually accepts client_root and set the asseturl with client root instead. However not sure if that's what we want with devchunkingcontext. This is part of metadata fixes for the test; however edge rendering still doesn't work so test doesn't pass yet. Closes WEB-1798
This commit is contained in:
parent
cf79cbf3b3
commit
85c3ea8e5b
2 changed files with 4 additions and 6 deletions
|
@ -534,7 +534,6 @@ impl Project {
|
|||
get_edge_chunking_context(
|
||||
self.project_path(),
|
||||
self.node_root(),
|
||||
self.client_relative_path(),
|
||||
self.edge_compile_time_info().environment(),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ use turbopack_binding::{
|
|||
|
||||
use crate::{
|
||||
mode::NextMode,
|
||||
next_client::context::get_client_assets_path,
|
||||
next_config::NextConfig,
|
||||
next_import_map::get_next_edge_import_map,
|
||||
next_server::context::ServerContextType,
|
||||
|
@ -155,15 +154,15 @@ pub async fn get_edge_resolve_options_context(
|
|||
pub fn get_edge_chunking_context(
|
||||
project_path: Vc<FileSystemPath>,
|
||||
node_root: Vc<FileSystemPath>,
|
||||
client_root: Vc<FileSystemPath>,
|
||||
environment: Vc<Environment>,
|
||||
) -> Vc<Box<dyn EcmascriptChunkingContext>> {
|
||||
let output_root = node_root.join("server/edge".to_string());
|
||||
Vc::upcast(
|
||||
DevChunkingContext::builder(
|
||||
project_path,
|
||||
node_root.join("server/edge".to_string()),
|
||||
node_root.join("server/edge/chunks".to_string()),
|
||||
get_client_assets_path(client_root),
|
||||
output_root,
|
||||
output_root.join("chunks".to_string()),
|
||||
output_root.join("assets".to_string()),
|
||||
environment,
|
||||
)
|
||||
.reference_chunk_source_maps(should_debug("edge"))
|
||||
|
|
Loading…
Reference in a new issue