Skip to content

Commit

Permalink
Revert "App Router - preinitialize chunks during SSR (#54752)"
Browse files Browse the repository at this point in the history
This reverts commit 09b0ca4.
  • Loading branch information
sokra committed Oct 6, 2023
1 parent 8fdd713 commit 5c6ea29
Show file tree
Hide file tree
Showing 192 changed files with 8,651 additions and 60,998 deletions.
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,14 @@
"random-seed": "0.3.0",
"react": "18.2.0",
"react-17": "npm:react@17.0.2",
"react-builtin": "npm:react@18.3.0-canary-d900fadbf-20230929",
"react-builtin": "npm:react@18.3.0-canary-09285d5a7-20230925",
"react-dom": "18.2.0",
"react-dom-17": "npm:react-dom@17.0.2",
"react-dom-builtin": "npm:react-dom@18.3.0-canary-d900fadbf-20230929",
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-d900fadbf-20230929",
"react-experimental-builtin": "npm:react@0.0.0-experimental-d900fadbf-20230929",
"react-server-dom-turbopack": "18.3.0-canary-d900fadbf-20230929",
"react-server-dom-turbopack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-d900fadbf-20230929",
"react-server-dom-webpack": "18.3.0-canary-d900fadbf-20230929",
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-d900fadbf-20230929",
"react-dom-builtin": "npm:react-dom@18.3.0-canary-09285d5a7-20230925",
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-09285d5a7-20230925",
"react-experimental-builtin": "npm:react@0.0.0-experimental-09285d5a7-20230925",
"react-server-dom-webpack": "18.3.0-canary-09285d5a7-20230925",
"react-server-dom-webpack-experimental": "npm:react-server-dom-webpack@0.0.0-experimental-09285d5a7-20230925",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
Expand All @@ -211,8 +209,8 @@
"resolve-from": "5.0.0",
"sass": "1.54.0",
"satori": "0.10.6",
"scheduler-builtin": "npm:scheduler@0.24.0-canary-d900fadbf-20230929",
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-d900fadbf-20230929",
"scheduler-builtin": "npm:scheduler@0.24.0-canary-09285d5a7-20230925",
"scheduler-experimental-builtin": "npm:scheduler@0.0.0-experimental-09285d5a7-20230925",
"seedrandom": "3.0.5",
"selenium-webdriver": "4.0.0-beta.4",
"semver": "7.3.7",
Expand Down
5 changes: 0 additions & 5 deletions packages/next-swc/crates/next-api/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ impl AppProject {
"next-dynamic".to_string(),
Vc::upcast(NextDynamicTransition::new(self.client_transition())),
),
("next-ssr".to_string(), Vc::upcast(self.ssr_transition())),
]
.into_iter()
.collect();
Expand Down Expand Up @@ -644,10 +643,6 @@ impl AppEndpoint {
client_references_chunks,
this.app_project.project().client_chunking_context(),
Vc::upcast(this.app_project.project().ssr_chunking_context()),
this.app_project
.project()
.next_config()
.computed_asset_prefix(),
);
server_assets.push(entry_manifest);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ pub async fn get_app_entries(
/// to `all_chunks`, and the chunking information will be added to the provided
/// manifests.
pub async fn compute_app_entries_chunks(
next_config: Vc<NextConfig>,
app_entries: &AppEntries,
app_client_reference_graph: Vc<ClientReferenceGraph>,
app_client_references_chunks: Vc<ClientReferencesChunks>,
Expand Down Expand Up @@ -351,7 +350,6 @@ pub async fn compute_app_entries_chunks(
app_client_references_chunks,
client_chunking_context,
ssr_chunking_context,
next_config.computed_asset_prefix(),
);

all_chunks.push(entry_manifest);
Expand Down
1 change: 0 additions & 1 deletion packages/next-swc/crates/next-build/src/next_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ pub(crate) async fn next_build(options: TransientInstance<BuildOptions>) -> Resu
// TODO(alexkirsz) Do some of that in parallel with the above.

compute_app_entries_chunks(
next_config,
&app_entries,
app_client_references,
app_client_references_chunks,
Expand Down
55 changes: 14 additions & 41 deletions packages/next-swc/crates/next-core/src/next_import_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@ pub async fn get_next_client_import_map(
} else {
""
};
import_map.insert_exact_alias(
"server-only",
request_to_import_mapping(app_dir, "next/dist/compiled/server-only"),
);
import_map.insert_exact_alias(
"client-only",
request_to_import_mapping(app_dir, "next/dist/compiled/client-only"),
);
import_map.insert_exact_alias(
"react",
request_to_import_mapping(
Expand Down Expand Up @@ -134,7 +126,7 @@ pub async fn get_next_client_import_map(
"react-server-dom-webpack/",
request_to_import_mapping(
app_dir,
&format!("next/dist/compiled/react-server-dom-turbopack{react_flavor}/*"),
&format!("next/dist/compiled/react-server-dom-webpack{react_flavor}/*"),
),
);
import_map.insert_exact_alias(
Expand Down Expand Up @@ -267,6 +259,7 @@ pub async fn get_next_server_import_map(
import_map.insert_wildcard_alias("react-dom/", external);
import_map.insert_exact_alias("styled-jsx", external);
import_map.insert_wildcard_alias("styled-jsx/", external);
import_map.insert_wildcard_alias("react-server-dom-webpack/", external);
// TODO: we should not bundle next/dist/build/utils in the pages renderer at all
import_map.insert_wildcard_alias("next/dist/build/utils", external);
}
Expand All @@ -288,10 +281,6 @@ pub async fn get_next_server_import_map(
"next/dynamic",
request_to_import_mapping(project_path, "next/dist/shared/lib/app-dynamic"),
);
import_map.insert_exact_alias(
"react-server-dom-webpack/",
ImportMapping::External(Some("react-server-dom-turbopack".into())).cell(),
);
}
ServerContextType::Middleware => {}
}
Expand Down Expand Up @@ -544,16 +533,14 @@ async fn insert_next_server_special_aliases(
app_dir,
match (runtime, server_actions) {
(NextRuntime::Edge, true) => {
"next/dist/compiled/react-server-dom-turbopack-experimental/client.edge"
"next/dist/compiled/react-server-dom-webpack-experimental/client.edge"
}
(NextRuntime::Edge, false) => {
"next/dist/compiled/react-server-dom-turbopack/client.edge"
"next/dist/compiled/react-server-dom-webpack/client.edge"
}
// When we access the runtime we still use the webpack name. The runtime
// itself will substitute in the turbopack variant
(NextRuntime::NodeJs, _) => {
"next/dist/server/future/route-modules/app-page/vendored/ssr/\
react-server-dom-turbopack-client-edge"
react-server-dom-webpack-client-edge"
}
},
),
Expand All @@ -567,16 +554,14 @@ async fn insert_next_server_special_aliases(
app_dir,
match (runtime, server_actions) {
(NextRuntime::Edge, true) => {
"next/dist/compiled/react-server-dom-turbopack-experimental/client.edge"
"next/dist/compiled/react-server-dom-webpack-experimental/client.edge"
}
(NextRuntime::Edge, false) => {
"next/dist/compiled/react-server-dom-turbopack/client.edge"
"next/dist/compiled/react-server-dom-webpack/client.edge"
}
// When we access the runtime we still use the webpack name. The runtime
// itself will substitute in the turbopack variant
(NextRuntime::NodeJs, _) => {
"next/dist/server/future/route-modules/app-page/vendored/ssr/\
react-server-dom-turbopack-client-edge"
react-server-dom-webpack-client-edge"
}
},
),
Expand Down Expand Up @@ -669,14 +654,6 @@ async fn insert_next_server_special_aliases(
},
),
);
import_map.insert_exact_alias(
"server-only",
request_to_import_mapping(app_dir, "next/dist/compiled/server-only"),
);
import_map.insert_exact_alias(
"client-only",
request_to_import_mapping(app_dir, "next/dist/compiled/client-only"),
);
import_map.insert_exact_alias(
"react",
request_to_import_mapping(
Expand Down Expand Up @@ -709,16 +686,14 @@ async fn insert_next_server_special_aliases(
app_dir,
match (runtime, server_actions) {
(NextRuntime::Edge, true) => {
"next/dist/compiled/react-server-dom-turbopack-experimental/server.edge"
"next/dist/compiled/react-server-dom-webpack-experimental/server.edge"
}
(NextRuntime::Edge, false) => {
"next/dist/compiled/react-server-dom-turbopack/server.edge"
"next/dist/compiled/react-server-dom-webpack/server.edge"
}
// When we access the runtime we still use the webpack name. The runtime
// itself will substitute in the turbopack variant
(NextRuntime::NodeJs, _) => {
"next/dist/server/future/route-modules/app-page/vendored/rsc/\
react-server-dom-turbopack-server-edge"
react-server-dom-webpack-server-edge"
}
},
),
Expand All @@ -729,16 +704,14 @@ async fn insert_next_server_special_aliases(
app_dir,
match (runtime, server_actions) {
(NextRuntime::Edge, true) => {
"next/dist/compiled/react-server-dom-turbopack-experimental/server.node"
"next/dist/compiled/react-server-dom-webpack-experimental/server.node"
}
(NextRuntime::Edge, false) => {
"next/dist/compiled/react-server-dom-turbopack/server.node"
"next/dist/compiled/react-server-dom-webpack/server.node"
}
// When we access the runtime we still use the webpack name. The runtime
// itself will substitute in the turbopack variant
(NextRuntime::NodeJs, _) => {
"next/dist/server/future/route-modules/app-page/vendored/rsc/\
react-server-dom-turbopack-server-node"
react-server-dom-webpack-server-node"
}
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,8 @@ impl ClientReferenceManifest {
client_references_chunks: Vc<ClientReferencesChunks>,
client_chunking_context: Vc<Box<dyn EcmascriptChunkingContext>>,
ssr_chunking_context: Vc<Box<dyn EcmascriptChunkingContext>>,
asset_prefix: Vc<Option<String>>,
) -> Result<Vc<Box<dyn OutputAsset>>> {
let mut entry_manifest: ClientReferenceManifest = Default::default();
entry_manifest.module_loading.prefix = asset_prefix
.await?
.as_ref()
.map(|p| p.to_owned())
.unwrap_or_default();
entry_manifest.module_loading.cross_origin = None;
let client_references_chunks = client_references_chunks.await?;
let client_relative_path = client_relative_path.await?;
let node_root_ref = node_root.await?;
Expand Down
8 changes: 0 additions & 8 deletions packages/next-swc/crates/next-core/src/next_manifests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ pub enum ActionLayer {
#[derive(Serialize, Default, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ClientReferenceManifest {
pub module_loading: ModuleLoading,
/// Mapping of module path and export name to client module ID and required
/// client chunks.
pub client_modules: ManifestNode,
Expand All @@ -197,13 +196,6 @@ pub struct ClientReferenceManifest {
pub entry_css_files: HashMap<String, Vec<String>>,
}

#[derive(Serialize, Default, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ModuleLoading {
pub prefix: String,
pub cross_origin: Option<String>,
}

#[derive(Serialize, Default, Debug)]
#[serde(rename_all = "camelCase")]
pub struct ManifestNode {
Expand Down
6 changes: 0 additions & 6 deletions packages/next/src/build/deployment-id.ts

This file was deleted.

Loading

0 comments on commit 5c6ea29

Please sign in to comment.