Build is failing with Unfinished hook action(s) on exit: (proxyRemoteEntry) load "virtual:mf-REMOTE_ENTRY_ID"
Is there a way to debug the error?
x Build failed in 2.20s
error during build:
Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(proxyRemoteEntry) load "virtual:mf-REMOTE_ENTRY_ID"
With VSCode you can run scripts in debug mode and you can use the breakpoints to proceed step by step.
Is there a way to debug the error?
x Build failed in 2.20s error during build: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit: (proxyRemoteEntry) load "virtual:mf-REMOTE_ENTRY_ID"
Could you provide a reproducible example? I have a general idea of the cause of this error, but I don’t know how to reproduce it. @mshima
@zhangHongEn I've found the error.
The exposed modules was not found.
Execution vite correctly shows the error message, but vite build erroring with this error.
Happened when migrating from Webpack which does not require vue extension in exposes.
@mshima Can we add a warning in the terminal for this?
@mshima Can we add a warning in the terminal for this?
Would be nice to fail with correct error message.
Can we throw the correct one?
build fail in linux,but work well in windows10
build fail in linux,but work well in windows10
https://github.com/module-federation/vite/issues/245 same issue in docker env
I just ran into this and debugged the code
? {
find: new RegExp(`(.*${PREBUILD_TAG}.*)`),
replacement: function ($1: string) {
const pkgName = (VirtualModule.findModule(PREBUILD_TAG, $1) as VirtualModule)
.name;
return pkgName;
},
}
: {
find: new RegExp(`(.*${PREBUILD_TAG}.*)`),
replacement: '$1',
async customResolver(source: string, importer: string) {
const pkgName = (
VirtualModule.findModule(PREBUILD_TAG, source) as VirtualModule
).name;
const result = await (this as any)
.resolve(pkgName, importer)
.then((item: any) => item.id);
if (!result.includes(_config.cacheDir)) {
// save pre-bunding module id
savePrebuild.set(pkgName, Promise.resolve(result));
}
// Fix localSharedImportMap import id
return await (this as any).resolve(await savePrebuild.get(pkgName), importer);
},
static findModule(tag: string, str: string = ''): VirtualModule | undefined {
if (!patternMap[tag])
patternMap[tag] = new RegExp(`(.*${packageNameEncode(tag)}(.+?)${packageNameEncode(tag)}.*)`);
const moduleName = (str.match(patternMap[tag]) || [])[2];
if (moduleName)
return cacheMap[tag][packageNameDecode(moduleName)] as VirtualModule | undefined;
return undefined;
}
Issue is if you return undefined; the promise resolves, but then it tries to access meta on undefined. This needs to be handled and an error thrown if its not in the maps?.
Meaning you need to add X to your package.json
Hopefully someone can make a PR for this as the issue seems to be simple. I am personally waiting to move to rolldowns MF plugin long term, so I likely won't contribute on this, past this info.
Getting same error on windows...did anyone managed to reolve this ?
Getting the same error on Mac. Patching the lib fixed it temporarily.
@abdoIO can you share your patch please?
@abdoIO can you share your patch please?
https://github.com/module-federation/vite/issues/132#issuecomment-2895948769 look at what i found.
@abdoIO can you share your patch please?
https://github.com/module-federation/vite/issues/132#issuecomment-2895948769 look at what i found.
Sorry, but can you tell us how to apply this fix and in which file ?
@abdoIO can you share your patch please?
#132 (comment) look at what i found.
Sorry, but can you tell us how to apply this fix and in which file ?
https://github.com/module-federation/vite/blob/1aaf099e6de71e1ae9eba4f8495e289c9d210c53/src/utils/VirtualModule.ts#L90
I forgot the details on what I did but the fix was pretty simple.
https://github.com/module-federation/vite/blob/1aaf099e6de71e1ae9eba4f8495e289c9d210c53/src/plugins/pluginProxySharedModule_preBuild.ts#L84 accesses assuming it will always be valid, causing the error
I resolved this build issue temporary by debuggin my vite.config file and commenting things one by one and then trying to build....i found that in my case it was 1 expose causing the error...after commenting this line...build was successful.
exposes: {
....,
"./types": "./src/types/index.ts",
}
In my case, the error was on CI but not locally, fixed by moving the "react" plugin below the MFE@Vite in the config.
This error only appears to happen in our Ubuntu instances, in both CI and local. MacOS and Windows build just fine.
EDIT: Import path typo caused Ubuntu build to fail. Somehow worked in MacOS and Windows.
Is there a plan to release this in a 1.8.1 version? Thank you in advance.
Is there a plan to release this in a 1.8.1 version? Thank you in advance.
It is PR https://github.com/module-federation/vite/pull/336 if interested.
Is there a plan to release this in a 1.8.1 version? Thank you in advance.
Released 👍
Got same error, after some debugging found that my employer's build system copying files of my package to other directory for isolated builds. And doesn't copies .css files, so this resolve never happens: https://github.com/module-federation/vite/blob/main/src/plugins/pluginModuleParseEnd.ts#L55
Is it possible, maybe, to print problematic files within the error? I started to print difference between parseStartSet and parseEndSet, got newly imported files in my PR, looked at them and found that they all importing .css files and they are not included in our build system config. But way to debug this was non-trivial and I still not understand why I got module federation error instead of some vite error that imports cannot be resolved.
UPD: oh, I remembered, I also tried to just call _resolve(1) with if (parseStartSet.size === 2300 && parseEndSet.size === 2296) { _resolve(1); } (to call it right before error) and finally got error about missing files for imports.