From 2342bf6e69793edd4d585824ad1df94a5bc19da0 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 4 May 2023 10:11:22 +0200 Subject: [PATCH 1/3] fix CSS HMR --- crates/turbopack-dev/js/src/runtime.dom.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/turbopack-dev/js/src/runtime.dom.js b/crates/turbopack-dev/js/src/runtime.dom.js index 9bd599879f916..dd01afb450376 100644 --- a/crates/turbopack-dev/js/src/runtime.dom.js +++ b/crates/turbopack-dev/js/src/runtime.dom.js @@ -77,9 +77,11 @@ let BACKEND; reject(new Error("The DOM backend can only reload CSS chunks")); return; } + + const encodedChunkPath = encodeURIComponent(chunkPath).replace(/%2F/g, "/"); const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -89,7 +91,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; From dcabc255aa35aa9288a5d8e10ce70a292e9bd14d Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 4 May 2023 08:34:25 +0000 Subject: [PATCH 2/3] use split --- crates/turbopack-dev/js/src/runtime.dom.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/turbopack-dev/js/src/runtime.dom.js b/crates/turbopack-dev/js/src/runtime.dom.js index dd01afb450376..91aeaa6e327eb 100644 --- a/crates/turbopack-dev/js/src/runtime.dom.js +++ b/crates/turbopack-dev/js/src/runtime.dom.js @@ -77,8 +77,11 @@ let BACKEND; reject(new Error("The DOM backend can only reload CSS chunks")); return; } - - const encodedChunkPath = encodeURIComponent(chunkPath).replace(/%2F/g, "/"); + + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); const previousLink = document.querySelector( `link[rel=stylesheet][href^="/${encodedChunkPath}"]` From b70a55ecb3090e3dc316f9eb362f237e48304a1b Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 4 May 2023 08:34:45 +0000 Subject: [PATCH 3/3] update snapshots --- ...ests_snapshot_basic_async_chunk_input_index_0d348e.js | 9 +++++++-- ...ts_tests_snapshot_basic_chunked_input_index_e77e9f.js | 9 +++++++-- ...ts_tests_snapshot_basic_shebang_input_index_b1f0c2.js | 9 +++++++-- ..._tests_snapshot_comptime_define_input_index_6b0d2b.js | 9 +++++++-- ...napshot_css_absolute-uri-import_input_index_fa9a30.js | 9 +++++++-- ...ck-tests_tests_snapshot_css_css_input_index_37a138.js | 9 +++++++-- ..._tests_snapshot_emotion_emotion_input_index_b080c4.js | 9 +++++++-- ...ck-tests_tests_snapshot_env_env_input_index_29a23f.js | 9 +++++++-- ..._evaluated_entrry_runtime_entry_input_index_f59cc7.js | 9 +++++++-- ..._tests_snapshot_example_example_input_index_78b6bf.js | 9 +++++++-- ...ests_snapshot_export-alls_cjs-2_input_index_289ae7.js | 9 +++++++-- ...snapshot_export-alls_cjs-script_input_index_3e96b7.js | 9 +++++++-- ..._tests_snapshot_import-meta_cjs_input_index_537553.js | 9 +++++++-- ...apshot_import-meta_esm-multiple_input_index_c00392.js | 9 +++++++-- ...napshot_import-meta_esm-mutable_input_index_6c9201.js | 9 +++++++-- ...snapshot_import-meta_esm-object_input_index_6fcf7d.js | 9 +++++++-- ..._tests_snapshot_import-meta_esm_input_index_c4c88a.js | 9 +++++++-- ..._tests_snapshot_import-meta_url_input_index_988b57.js | 9 +++++++-- ..._tests_snapshot_imports_dynamic_input_index_45c162.js | 9 +++++++-- ...sts_tests_snapshot_imports_json_input_index_961ae2.js | 9 +++++++-- ...pshot_imports_resolve_error_cjs_input_index_f8412b.js | 9 +++++++-- ...pshot_imports_resolve_error_esm_input_index_0b3e45.js | 9 +++++++-- ...shot_imports_static-and-dynamic_input_index_ec8693.js | 9 +++++++-- ...s_tests_snapshot_imports_static_input_index_885269.js | 9 +++++++-- ...hot_node_node_protocol_external_input_index_667edf.js | 9 +++++++-- ...ed_components_styled_components_input_index_afc482.js | 9 +++++++-- ...ms_mono_transforms_input_packages_app_index_4a3d65.js | 9 +++++++-- ...pshot_swc_transforms_preset_env_input_index_9dcfd0.js | 9 +++++++-- ...hot_typescript_jsconfig-baseurl_input_index_8f1e58.js | 9 +++++++-- ...ypescript_tsconfig-baseurl_input_index.ts_0aa04e._.js | 9 +++++++-- ...g-extends-module-full-path_input_index.ts_a751eb._.js | 9 +++++++-- ...pt_tsconfig-extends-module_input_index.ts_a662d4._.js | 9 +++++++-- ...onfig-extends-relative-dir_input_index.ts_be3d7b._.js | 9 +++++++-- ...config-extends-without-ext_input_index.ts_38aae8._.js | 9 +++++++-- ...ypescript_tsconfig-extends_input_index.ts_18c083._.js | 9 +++++++-- 35 files changed, 245 insertions(+), 70 deletions(-) diff --git a/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_index_0d348e.js b/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_index_0d348e.js index db9733134e271..4465bb6af2a87 100644 --- a/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_index_0d348e.js +++ b/crates/turbopack-tests/tests/snapshot/basic/async_chunk/output/crates_turbopack-tests_tests_snapshot_basic_async_chunk_input_index_0d348e.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/basic/chunked/output/crates_turbopack-tests_tests_snapshot_basic_chunked_input_index_e77e9f.js b/crates/turbopack-tests/tests/snapshot/basic/chunked/output/crates_turbopack-tests_tests_snapshot_basic_chunked_input_index_e77e9f.js index 173fbd8a0df4e..3823c10ba3e0a 100644 --- a/crates/turbopack-tests/tests/snapshot/basic/chunked/output/crates_turbopack-tests_tests_snapshot_basic_chunked_input_index_e77e9f.js +++ b/crates/turbopack-tests/tests/snapshot/basic/chunked/output/crates_turbopack-tests_tests_snapshot_basic_chunked_input_index_e77e9f.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/basic/shebang/output/crates_turbopack-tests_tests_snapshot_basic_shebang_input_index_b1f0c2.js b/crates/turbopack-tests/tests/snapshot/basic/shebang/output/crates_turbopack-tests_tests_snapshot_basic_shebang_input_index_b1f0c2.js index d264bfff485ec..222aeaa93db87 100644 --- a/crates/turbopack-tests/tests/snapshot/basic/shebang/output/crates_turbopack-tests_tests_snapshot_basic_shebang_input_index_b1f0c2.js +++ b/crates/turbopack-tests/tests/snapshot/basic/shebang/output/crates_turbopack-tests_tests_snapshot_basic_shebang_input_index_b1f0c2.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/comptime/define/output/crates_turbopack-tests_tests_snapshot_comptime_define_input_index_6b0d2b.js b/crates/turbopack-tests/tests/snapshot/comptime/define/output/crates_turbopack-tests_tests_snapshot_comptime_define_input_index_6b0d2b.js index 8817feac25cd2..2c292af380aa5 100644 --- a/crates/turbopack-tests/tests/snapshot/comptime/define/output/crates_turbopack-tests_tests_snapshot_comptime_define_input_index_6b0d2b.js +++ b/crates/turbopack-tests/tests/snapshot/comptime/define/output/crates_turbopack-tests_tests_snapshot_comptime_define_input_index_6b0d2b.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/css/absolute-uri-import/output/crates_turbopack-tests_tests_snapshot_css_absolute-uri-import_input_index_fa9a30.js b/crates/turbopack-tests/tests/snapshot/css/absolute-uri-import/output/crates_turbopack-tests_tests_snapshot_css_absolute-uri-import_input_index_fa9a30.js index 531535b77b56d..84ded1c4ffb41 100644 --- a/crates/turbopack-tests/tests/snapshot/css/absolute-uri-import/output/crates_turbopack-tests_tests_snapshot_css_absolute-uri-import_input_index_fa9a30.js +++ b/crates/turbopack-tests/tests/snapshot/css/absolute-uri-import/output/crates_turbopack-tests_tests_snapshot_css_absolute-uri-import_input_index_fa9a30.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/css/css/output/crates_turbopack-tests_tests_snapshot_css_css_input_index_37a138.js b/crates/turbopack-tests/tests/snapshot/css/css/output/crates_turbopack-tests_tests_snapshot_css_css_input_index_37a138.js index 32fa5a5a28427..94bc00383f757 100644 --- a/crates/turbopack-tests/tests/snapshot/css/css/output/crates_turbopack-tests_tests_snapshot_css_css_input_index_37a138.js +++ b/crates/turbopack-tests/tests/snapshot/css/css/output/crates_turbopack-tests_tests_snapshot_css_css_input_index_37a138.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/crates_turbopack-tests_tests_snapshot_emotion_emotion_input_index_b080c4.js b/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/crates_turbopack-tests_tests_snapshot_emotion_emotion_input_index_b080c4.js index b71f5dee25f96..398a6fc4ff0ef 100644 --- a/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/crates_turbopack-tests_tests_snapshot_emotion_emotion_input_index_b080c4.js +++ b/crates/turbopack-tests/tests/snapshot/emotion/emotion/output/crates_turbopack-tests_tests_snapshot_emotion_emotion_input_index_b080c4.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/env/env/output/crates_turbopack-tests_tests_snapshot_env_env_input_index_29a23f.js b/crates/turbopack-tests/tests/snapshot/env/env/output/crates_turbopack-tests_tests_snapshot_env_env_input_index_29a23f.js index c468aeed626e9..ef8969475acef 100644 --- a/crates/turbopack-tests/tests/snapshot/env/env/output/crates_turbopack-tests_tests_snapshot_env_env_input_index_29a23f.js +++ b/crates/turbopack-tests/tests/snapshot/env/env/output/crates_turbopack-tests_tests_snapshot_env_env_input_index_29a23f.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/evaluated_entrry/runtime_entry/output/a587c_tests_snapshot_evaluated_entrry_runtime_entry_input_index_f59cc7.js b/crates/turbopack-tests/tests/snapshot/evaluated_entrry/runtime_entry/output/a587c_tests_snapshot_evaluated_entrry_runtime_entry_input_index_f59cc7.js index cb989e9281277..919e755ae80e7 100644 --- a/crates/turbopack-tests/tests/snapshot/evaluated_entrry/runtime_entry/output/a587c_tests_snapshot_evaluated_entrry_runtime_entry_input_index_f59cc7.js +++ b/crates/turbopack-tests/tests/snapshot/evaluated_entrry/runtime_entry/output/a587c_tests_snapshot_evaluated_entrry_runtime_entry_input_index_f59cc7.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/example/example/output/crates_turbopack-tests_tests_snapshot_example_example_input_index_78b6bf.js b/crates/turbopack-tests/tests/snapshot/example/example/output/crates_turbopack-tests_tests_snapshot_example_example_input_index_78b6bf.js index dafd2e36cb45a..4515e228c494f 100644 --- a/crates/turbopack-tests/tests/snapshot/example/example/output/crates_turbopack-tests_tests_snapshot_example_example_input_index_78b6bf.js +++ b/crates/turbopack-tests/tests/snapshot/example/example/output/crates_turbopack-tests_tests_snapshot_example_example_input_index_78b6bf.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/output/crates_turbopack-tests_tests_snapshot_export-alls_cjs-2_input_index_289ae7.js b/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/output/crates_turbopack-tests_tests_snapshot_export-alls_cjs-2_input_index_289ae7.js index 075dd39093cea..edaa39881c3b6 100644 --- a/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/output/crates_turbopack-tests_tests_snapshot_export-alls_cjs-2_input_index_289ae7.js +++ b/crates/turbopack-tests/tests/snapshot/export-alls/cjs-2/output/crates_turbopack-tests_tests_snapshot_export-alls_cjs-2_input_index_289ae7.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/export-alls/cjs-script/output/crates_turbopack-tests_tests_snapshot_export-alls_cjs-script_input_index_3e96b7.js b/crates/turbopack-tests/tests/snapshot/export-alls/cjs-script/output/crates_turbopack-tests_tests_snapshot_export-alls_cjs-script_input_index_3e96b7.js index 13ca4d8c4c09e..e026ad812cc2e 100644 --- a/crates/turbopack-tests/tests/snapshot/export-alls/cjs-script/output/crates_turbopack-tests_tests_snapshot_export-alls_cjs-script_input_index_3e96b7.js +++ b/crates/turbopack-tests/tests/snapshot/export-alls/cjs-script/output/crates_turbopack-tests_tests_snapshot_export-alls_cjs-script_input_index_3e96b7.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/import-meta/cjs/output/crates_turbopack-tests_tests_snapshot_import-meta_cjs_input_index_537553.js b/crates/turbopack-tests/tests/snapshot/import-meta/cjs/output/crates_turbopack-tests_tests_snapshot_import-meta_cjs_input_index_537553.js index 5a03e655e0a4c..8227687c9ee75 100644 --- a/crates/turbopack-tests/tests/snapshot/import-meta/cjs/output/crates_turbopack-tests_tests_snapshot_import-meta_cjs_input_index_537553.js +++ b/crates/turbopack-tests/tests/snapshot/import-meta/cjs/output/crates_turbopack-tests_tests_snapshot_import-meta_cjs_input_index_537553.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/import-meta/esm-multiple/output/79fb1_turbopack-tests_tests_snapshot_import-meta_esm-multiple_input_index_c00392.js b/crates/turbopack-tests/tests/snapshot/import-meta/esm-multiple/output/79fb1_turbopack-tests_tests_snapshot_import-meta_esm-multiple_input_index_c00392.js index e294815d25980..6d4e1a9d52e57 100644 --- a/crates/turbopack-tests/tests/snapshot/import-meta/esm-multiple/output/79fb1_turbopack-tests_tests_snapshot_import-meta_esm-multiple_input_index_c00392.js +++ b/crates/turbopack-tests/tests/snapshot/import-meta/esm-multiple/output/79fb1_turbopack-tests_tests_snapshot_import-meta_esm-multiple_input_index_c00392.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/import-meta/esm-mutable/output/crates_turbopack-tests_tests_snapshot_import-meta_esm-mutable_input_index_6c9201.js b/crates/turbopack-tests/tests/snapshot/import-meta/esm-mutable/output/crates_turbopack-tests_tests_snapshot_import-meta_esm-mutable_input_index_6c9201.js index e3779a398a985..b59eb0f881a88 100644 --- a/crates/turbopack-tests/tests/snapshot/import-meta/esm-mutable/output/crates_turbopack-tests_tests_snapshot_import-meta_esm-mutable_input_index_6c9201.js +++ b/crates/turbopack-tests/tests/snapshot/import-meta/esm-mutable/output/crates_turbopack-tests_tests_snapshot_import-meta_esm-mutable_input_index_6c9201.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/import-meta/esm-object/output/crates_turbopack-tests_tests_snapshot_import-meta_esm-object_input_index_6fcf7d.js b/crates/turbopack-tests/tests/snapshot/import-meta/esm-object/output/crates_turbopack-tests_tests_snapshot_import-meta_esm-object_input_index_6fcf7d.js index 0b065108c8544..1c5f21e754746 100644 --- a/crates/turbopack-tests/tests/snapshot/import-meta/esm-object/output/crates_turbopack-tests_tests_snapshot_import-meta_esm-object_input_index_6fcf7d.js +++ b/crates/turbopack-tests/tests/snapshot/import-meta/esm-object/output/crates_turbopack-tests_tests_snapshot_import-meta_esm-object_input_index_6fcf7d.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/import-meta/esm/output/crates_turbopack-tests_tests_snapshot_import-meta_esm_input_index_c4c88a.js b/crates/turbopack-tests/tests/snapshot/import-meta/esm/output/crates_turbopack-tests_tests_snapshot_import-meta_esm_input_index_c4c88a.js index 113115928b8d8..9e3821c84932d 100644 --- a/crates/turbopack-tests/tests/snapshot/import-meta/esm/output/crates_turbopack-tests_tests_snapshot_import-meta_esm_input_index_c4c88a.js +++ b/crates/turbopack-tests/tests/snapshot/import-meta/esm/output/crates_turbopack-tests_tests_snapshot_import-meta_esm_input_index_c4c88a.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/import-meta/url/output/crates_turbopack-tests_tests_snapshot_import-meta_url_input_index_988b57.js b/crates/turbopack-tests/tests/snapshot/import-meta/url/output/crates_turbopack-tests_tests_snapshot_import-meta_url_input_index_988b57.js index 4189b0df5380f..6997958638d01 100644 --- a/crates/turbopack-tests/tests/snapshot/import-meta/url/output/crates_turbopack-tests_tests_snapshot_import-meta_url_input_index_988b57.js +++ b/crates/turbopack-tests/tests/snapshot/import-meta/url/output/crates_turbopack-tests_tests_snapshot_import-meta_url_input_index_988b57.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/imports/dynamic/output/crates_turbopack-tests_tests_snapshot_imports_dynamic_input_index_45c162.js b/crates/turbopack-tests/tests/snapshot/imports/dynamic/output/crates_turbopack-tests_tests_snapshot_imports_dynamic_input_index_45c162.js index 1bd1bde9a1f0e..7693b91dbad34 100644 --- a/crates/turbopack-tests/tests/snapshot/imports/dynamic/output/crates_turbopack-tests_tests_snapshot_imports_dynamic_input_index_45c162.js +++ b/crates/turbopack-tests/tests/snapshot/imports/dynamic/output/crates_turbopack-tests_tests_snapshot_imports_dynamic_input_index_45c162.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/imports/json/output/crates_turbopack-tests_tests_snapshot_imports_json_input_index_961ae2.js b/crates/turbopack-tests/tests/snapshot/imports/json/output/crates_turbopack-tests_tests_snapshot_imports_json_input_index_961ae2.js index 4d8909a4fa16c..4ac4c902ea2a1 100644 --- a/crates/turbopack-tests/tests/snapshot/imports/json/output/crates_turbopack-tests_tests_snapshot_imports_json_input_index_961ae2.js +++ b/crates/turbopack-tests/tests/snapshot/imports/json/output/crates_turbopack-tests_tests_snapshot_imports_json_input_index_961ae2.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/imports/resolve_error_cjs/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_cjs_input_index_f8412b.js b/crates/turbopack-tests/tests/snapshot/imports/resolve_error_cjs/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_cjs_input_index_f8412b.js index 63a94d903f6ea..3d2fd27112a43 100644 --- a/crates/turbopack-tests/tests/snapshot/imports/resolve_error_cjs/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_cjs_input_index_f8412b.js +++ b/crates/turbopack-tests/tests/snapshot/imports/resolve_error_cjs/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_cjs_input_index_f8412b.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_esm_input_index_0b3e45.js b/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_esm_input_index_0b3e45.js index b8d9a79092d06..579e9f6af9476 100644 --- a/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_esm_input_index_0b3e45.js +++ b/crates/turbopack-tests/tests/snapshot/imports/resolve_error_esm/output/79fb1_turbopack-tests_tests_snapshot_imports_resolve_error_esm_input_index_0b3e45.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/imports/static-and-dynamic/output/79fb1_turbopack-tests_tests_snapshot_imports_static-and-dynamic_input_index_ec8693.js b/crates/turbopack-tests/tests/snapshot/imports/static-and-dynamic/output/79fb1_turbopack-tests_tests_snapshot_imports_static-and-dynamic_input_index_ec8693.js index 2df87366b807d..a4d65e963f770 100644 --- a/crates/turbopack-tests/tests/snapshot/imports/static-and-dynamic/output/79fb1_turbopack-tests_tests_snapshot_imports_static-and-dynamic_input_index_ec8693.js +++ b/crates/turbopack-tests/tests/snapshot/imports/static-and-dynamic/output/79fb1_turbopack-tests_tests_snapshot_imports_static-and-dynamic_input_index_ec8693.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/imports/static/output/crates_turbopack-tests_tests_snapshot_imports_static_input_index_885269.js b/crates/turbopack-tests/tests/snapshot/imports/static/output/crates_turbopack-tests_tests_snapshot_imports_static_input_index_885269.js index b1493a776ef18..c5fc1a3ba186a 100644 --- a/crates/turbopack-tests/tests/snapshot/imports/static/output/crates_turbopack-tests_tests_snapshot_imports_static_input_index_885269.js +++ b/crates/turbopack-tests/tests/snapshot/imports/static/output/crates_turbopack-tests_tests_snapshot_imports_static_input_index_885269.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/node/node_protocol_external/output/79fb1_turbopack-tests_tests_snapshot_node_node_protocol_external_input_index_667edf.js b/crates/turbopack-tests/tests/snapshot/node/node_protocol_external/output/79fb1_turbopack-tests_tests_snapshot_node_node_protocol_external_input_index_667edf.js index b829c5dc52e16..5bdbec4adba02 100644 --- a/crates/turbopack-tests/tests/snapshot/node/node_protocol_external/output/79fb1_turbopack-tests_tests_snapshot_node_node_protocol_external_input_index_667edf.js +++ b/crates/turbopack-tests/tests/snapshot/node/node_protocol_external/output/79fb1_turbopack-tests_tests_snapshot_node_node_protocol_external_input_index_667edf.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/styled_components/styled_components/output/a587c_tests_snapshot_styled_components_styled_components_input_index_afc482.js b/crates/turbopack-tests/tests/snapshot/styled_components/styled_components/output/a587c_tests_snapshot_styled_components_styled_components_input_index_afc482.js index 5a97786eaf754..e6b3faa493db9 100644 --- a/crates/turbopack-tests/tests/snapshot/styled_components/styled_components/output/a587c_tests_snapshot_styled_components_styled_components_input_index_afc482.js +++ b/crates/turbopack-tests/tests/snapshot/styled_components/styled_components/output/a587c_tests_snapshot_styled_components_styled_components_input_index_afc482.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/a587c_tests_snapshot_swc_transforms_mono_transforms_input_packages_app_index_4a3d65.js b/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/a587c_tests_snapshot_swc_transforms_mono_transforms_input_packages_app_index_4a3d65.js index d402c7064d002..4027bc340b874 100644 --- a/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/a587c_tests_snapshot_swc_transforms_mono_transforms_input_packages_app_index_4a3d65.js +++ b/crates/turbopack-tests/tests/snapshot/swc_transforms/mono_transforms/output/a587c_tests_snapshot_swc_transforms_mono_transforms_input_packages_app_index_4a3d65.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/79fb1_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_9dcfd0.js b/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/79fb1_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_9dcfd0.js index 70c6924f0c0b1..adadb585c5f29 100644 --- a/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/79fb1_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_9dcfd0.js +++ b/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/79fb1_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_9dcfd0.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/typescript/jsconfig-baseurl/output/79fb1_turbopack-tests_tests_snapshot_typescript_jsconfig-baseurl_input_index_8f1e58.js b/crates/turbopack-tests/tests/snapshot/typescript/jsconfig-baseurl/output/79fb1_turbopack-tests_tests_snapshot_typescript_jsconfig-baseurl_input_index_8f1e58.js index aaa42f08ebe8a..7783a5cc45326 100644 --- a/crates/turbopack-tests/tests/snapshot/typescript/jsconfig-baseurl/output/79fb1_turbopack-tests_tests_snapshot_typescript_jsconfig-baseurl_input_index_8f1e58.js +++ b/crates/turbopack-tests/tests/snapshot/typescript/jsconfig-baseurl/output/79fb1_turbopack-tests_tests_snapshot_typescript_jsconfig-baseurl_input_index_8f1e58.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-baseurl/output/a587c_tests_snapshot_typescript_tsconfig-baseurl_input_index.ts_0aa04e._.js b/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-baseurl/output/a587c_tests_snapshot_typescript_tsconfig-baseurl_input_index.ts_0aa04e._.js index 112d7f1b6742f..7690cd7f249c1 100644 --- a/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-baseurl/output/a587c_tests_snapshot_typescript_tsconfig-baseurl_input_index.ts_0aa04e._.js +++ b/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-baseurl/output/a587c_tests_snapshot_typescript_tsconfig-baseurl_input_index.ts_0aa04e._.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module-full-path/output/8562f_snapshot_typescript_tsconfig-extends-module-full-path_input_index.ts_a751eb._.js b/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module-full-path/output/8562f_snapshot_typescript_tsconfig-extends-module-full-path_input_index.ts_a751eb._.js index 85c9f0da20a4b..c212c89908d70 100644 --- a/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module-full-path/output/8562f_snapshot_typescript_tsconfig-extends-module-full-path_input_index.ts_a751eb._.js +++ b/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module-full-path/output/8562f_snapshot_typescript_tsconfig-extends-module-full-path_input_index.ts_a751eb._.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module/output/a587c_tests_snapshot_typescript_tsconfig-extends-module_input_index.ts_a662d4._.js b/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module/output/a587c_tests_snapshot_typescript_tsconfig-extends-module_input_index.ts_a662d4._.js index a78e01cdd362f..7e4bee976e903 100644 --- a/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module/output/a587c_tests_snapshot_typescript_tsconfig-extends-module_input_index.ts_a662d4._.js +++ b/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module/output/a587c_tests_snapshot_typescript_tsconfig-extends-module_input_index.ts_a662d4._.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-relative-dir/output/a587c_tests_snapshot_typescript_tsconfig-extends-relative-dir_input_index.ts_be3d7b._.js b/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-relative-dir/output/a587c_tests_snapshot_typescript_tsconfig-extends-relative-dir_input_index.ts_be3d7b._.js index 208512f913284..a374c7fc11b29 100644 --- a/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-relative-dir/output/a587c_tests_snapshot_typescript_tsconfig-extends-relative-dir_input_index.ts_be3d7b._.js +++ b/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-relative-dir/output/a587c_tests_snapshot_typescript_tsconfig-extends-relative-dir_input_index.ts_be3d7b._.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-without-ext/output/a587c_tests_snapshot_typescript_tsconfig-extends-without-ext_input_index.ts_38aae8._.js b/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-without-ext/output/a587c_tests_snapshot_typescript_tsconfig-extends-without-ext_input_index.ts_38aae8._.js index ecaeaece1f7ea..9aa287068a462 100644 --- a/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-without-ext/output/a587c_tests_snapshot_typescript_tsconfig-extends-without-ext_input_index.ts_38aae8._.js +++ b/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends-without-ext/output/a587c_tests_snapshot_typescript_tsconfig-extends-without-ext_input_index.ts_38aae8._.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); }; diff --git a/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends/output/a587c_tests_snapshot_typescript_tsconfig-extends_input_index.ts_18c083._.js b/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends/output/a587c_tests_snapshot_typescript_tsconfig-extends_input_index.ts_18c083._.js index 9beec3e43f705..706f246fbcdfc 100644 --- a/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends/output/a587c_tests_snapshot_typescript_tsconfig-extends_input_index.ts_18c083._.js +++ b/crates/turbopack-tests/tests/snapshot/typescript/tsconfig-extends/output/a587c_tests_snapshot_typescript_tsconfig-extends_input_index.ts_18c083._.js @@ -1592,8 +1592,13 @@ let BACKEND; return; } + const encodedChunkPath = chunkPath + .split("/") + .map((p) => encodeURIComponent(p)) + .join("/"); + const previousLink = document.querySelector( - `link[type=stylesheet][href^="/${chunkPath}"]` + `link[rel=stylesheet][href^="/${encodedChunkPath}"]` ); if (previousLink == null) { @@ -1603,7 +1608,7 @@ let BACKEND; const link = document.createElement("link"); link.rel = "stylesheet"; - link.href = `/${chunkPath}?t=${Date.now()}`; + link.href = `/${encodedChunkPath}`; link.onerror = () => { reject(); };