From 28a1c38d38dbc987e690205834e25c3fc9ca0420 Mon Sep 17 00:00:00 2001 From: pshu Date: Wed, 20 Nov 2024 10:17:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(SSU):=20=F0=9F=90=9B=20in=20case=20exte?= =?UTF-8?q?rnal=20not=20avaible=20to=20all=20=20entries?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/mako/src/plugins/central_ensure.rs | 2 +- crates/mako/src/plugins/ssu.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/mako/src/plugins/central_ensure.rs b/crates/mako/src/plugins/central_ensure.rs index 2f9d8ed49..b3fcbaaac 100644 --- a/crates/mako/src/plugins/central_ensure.rs +++ b/crates/mako/src/plugins/central_ensure.rs @@ -61,7 +61,7 @@ impl Plugin for CentralChunkEnsure { let map = {ensure_map}; requireModule.updateEnsure2Map = function(newMapping) {{ map = newMapping; - }} + }}; requireModule.ensure2 = function(chunkId){{ let toEnsure = map[chunkId]; if (toEnsure) {{ diff --git a/crates/mako/src/plugins/ssu.rs b/crates/mako/src/plugins/ssu.rs index 9754ea616..9d0fde055 100644 --- a/crates/mako/src/plugins/ssu.rs +++ b/crates/mako/src/plugins/ssu.rs @@ -256,7 +256,9 @@ require("{SSU_MOCK_JS_FILE}"); }}catch(e){{}}; let patch = require._su_patch(); console.log(patch); +try{{ {} +}}catch(e){{}} module.export = Promise.all( patch.map((d)=>__mako_require__.ensure(d)) ).then(()=>{{ @@ -566,7 +568,7 @@ requireModule._su_patch = function(){{ cssChunksIdToUrlMap[key] = css_patch[key]; }} return Object.keys(js_patch).sort(); -}} +}}; "#, serde_json::to_string(&cache.js_patch_map).unwrap(), serde_json::to_string(&cache.css_patch_map).unwrap(), @@ -598,7 +600,7 @@ requireModule._su_patch = function(){ cssChunksIdToUrlMap[key] = css_patch[key]; } return ["node_modules"]; -}"# +};"# .to_string()]) } } From 1ece7bb16aa658b5116a3c24ee5b6724ad760fdf Mon Sep 17 00:00:00 2001 From: pshu Date: Thu, 21 Nov 2024 07:24:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20=F0=9F=8E=A8=20explict=20ignore?= =?UTF-8?q?=20the=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/mako/src/plugins/ssu.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/mako/src/plugins/ssu.rs b/crates/mako/src/plugins/ssu.rs index 9d0fde055..83a683c13 100644 --- a/crates/mako/src/plugins/ssu.rs +++ b/crates/mako/src/plugins/ssu.rs @@ -258,7 +258,9 @@ let patch = require._su_patch(); console.log(patch); try{{ {} -}}catch(e){{}} +}}catch(e){{ +//ignore the error +}} module.export = Promise.all( patch.map((d)=>__mako_require__.ensure(d)) ).then(()=>{{