From e26d10712d98c450b9ae57babdfab27dee9e1dad Mon Sep 17 00:00:00 2001 From: Sergei Koshel <2191338+sk-pub@users.noreply.github.com> Date: Tue, 26 Nov 2024 00:44:23 +0100 Subject: [PATCH] fix(runtime): add @vite-ignore for dynamic import in loadEsmEntry (#3251) Co-authored-by: Zack Jackson <25274700+ScriptedAlchemy@users.noreply.github.com> --- .changeset/modern-experts-film.md | 5 +++++ packages/runtime/src/utils/load.ts | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/modern-experts-film.md diff --git a/.changeset/modern-experts-film.md b/.changeset/modern-experts-film.md new file mode 100644 index 00000000000..8a094ae1b5f --- /dev/null +++ b/.changeset/modern-experts-film.md @@ -0,0 +1,5 @@ +--- +'@module-federation/runtime': patch +--- + +add @vite-ignore for dynamic import in loadEsmEntry diff --git a/packages/runtime/src/utils/load.ts b/packages/runtime/src/utils/load.ts index 39dcef9617e..649c1449cc4 100644 --- a/packages/runtime/src/utils/load.ts +++ b/packages/runtime/src/utils/load.ts @@ -25,7 +25,9 @@ async function loadEsmEntry({ return new Promise((resolve, reject) => { try { if (!remoteEntryExports) { - import(/* webpackIgnore: true */ entry).then(resolve).catch(reject); + import(/* webpackIgnore: true */ /* @vite-ignore */ entry) + .then(resolve) + .catch(reject); } else { resolve(remoteEntryExports); }