From 105dcd712141b185364701ec28614561e5bc9673 Mon Sep 17 00:00:00 2001 From: unadlib Date: Tue, 12 Nov 2024 16:31:49 +0800 Subject: [PATCH] fix(mfe): fix workerRemote --- packages/builder/src/make.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/make.ts b/packages/builder/src/make.ts index 3469770..3eb363d 100644 --- a/packages/builder/src/make.ts +++ b/packages/builder/src/make.ts @@ -42,9 +42,11 @@ export const makeRemoteScript = ( const url = new URL(remoteEntry); // replace the default remote with the worker remote // e.g. http://localhost:3000/remoteEntry.js -> http://localhost:3000/worker/remoteEntry.js + const pathname = url.pathname.split('/'); + pathname.splice(-1, 0, 'worker'); const workerRemote = remoteEntry.replace( url.pathname, - `/worker${url.pathname}` + pathname.join('/') ); importScripts(workerRemote); }