-
-
Notifications
You must be signed in to change notification settings - Fork 303
@mf-types.zip not being generate since 0.2.7 #2827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@2heal1 can you take a look? |
does the build crash? or just throw error? |
@ScriptedAlchemy |
Hi guys! I bumped into the same exact issue, but in my case types are not generated at all. The bundle is built (static JS-chunks + manifest files), but neither The error i get when i run build script: The The I have Another problem is that
But when i run my build command again with specific typesFolder name, i still meet the same error message as it was: |
Some updates to my notes here :) So if we take a closer look to an error it firstly says that TS compile failed: So if i try to run this command manually i get i few TS erros while compiling. These errros come from Soooo if i go to So the problem of not building @mf-types.zip is the TS error inside
This is where this line of code is declared https://github.com/DefinitelyTyped/DefinitelyTyped/blame/master/types/ws/index.d.ts#L312 And my Node version is Rolling back to "@types/ws": "8.5.4" probably fixes the problem jfyi @2heal1 |
Do you happen to have any updates on this one? |
because now mf types will use project's tsconfig.json , so you can set |
I have this in my tsconfig. The same error is still there.. |
Try to run the specified command from the error message (in your case it is |
Hi guys, I'm also experiencing this problem, when I run Then stamp the ts type so he doesn't report errors, and you can generate the @mf-types.zip file |
@ryok90 upgrade to |
We've upgraded to this version and can confirm that the types are now generated as expected. For those still facing this issue: Ensure you do not have Typescript errors within your project. When we had errors this lead to the mf-types.zip not being generated. If that file was missing for a remote app, the host app would then delete the types of the remote app from its mf-types folder too. So ensure there are no Typescript errors in any of your applications. |
I came across this issue as well and was able to resolve by changing the exposed path from the root of the project to it's relative path. The problem was hard to identify because using the path from the root of the project worked when the type generation was disabled. Configuration that caused the failure:
Fixed configuration:
|
Yeah. Same rules as package.json exports field |
In my point of view the solution is already addressed here by:
I will write a short doc for this on the Error Catalog guide |
Docs updated, issue can be closed |
Just in case it helps someone else coming here. I was having the same issue, but it was due to the fact that I already had a tsconfig.json in the directory (which it extends when found) which had some settings that conflicted with what it expected. Also worth pointing out that even once I fixed that and the types generated properly on the first run without errors, every subsequent run generated a new tsconfig file and appended the newly generated types as files into the files list, which then promptly errors out: Second run generated a tsconfig which has the previously generated .d.ts files:
Manually re-running the tsc command gives:
I can open a new ticket if you guys want to track this issue separately, but wanted to get here for visibility. Technically, most folks won't run into this unless they have a tsconfig.json for some reason in a JS project that's being webpack'd without transpilation. I ran into it because I have a project where I'm doing both examples. That said, it's pretty easy to run into this issue accidentally when trying diff things out, so worth documenting here anyways. |
Interesting case. I will try to reproduce it and add it to the docs. Thanks for the investigation @arimus ! |
I'm following the quick start guide at https://module-federation.io/guide/start/quick-start.html. Trying the build or dev commands gives me the following error: Executing task: npm run build
> [email protected] build
> rsbuild build
Rsbuild v1.1.14
● web ━━━━━━━━━━━━━━━━━━━━━━━━━ (74%) sealing after module optimization [ Module Federation Dev Server ] Error Unable to compile federated typesError: Failed to generate type declaration. #TYPE-001
args: {"cmd":"npx tsc --project C:\\Projects\\module-federation\\federation_provider\\node_modules\\.federation\\tsconfig.640b668e9bc1c113939670178a7a6d19.json"}
https://module-federation.io/guide/troubleshooting/type/TYPE-001
Error in mf:generateTypes processAssets hook: Error: ENOENT: no such file or directory, open 'C:\Projects\module-federation\federation_provider\dist\@mf-types.zip'
at Object.openSync (node:fs:562:18)
at Object.readFileSync (node:fs:446:35)
at _GenerateTypesPlugin.<anonymous> (C:\Projects\module-federation\federation_provider\node_modules\@module-federation\dts-plugin\dist\index.js:2610:141)
at Generator.next (<anonymous>)
at fulfilled (C:\Projects\module-federation\federation_provider\node_modules\@module-federation\dts-plugin\dist\index.js:66:24)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Projects\\module-federation\\federation_provider\\dist\\@mf-types.zip'
}
● web ━━━━━━━━━━━━━━━━━━━━━━━━━ (100%) emitting after emit ready Built in 1.35 s (web)
File (web) Size Gzip
dist\index.html 0.31 kB 0.22 kB
dist\static\css\async\677.54800c1b.css 0.34 kB 0.25 kB
dist\static\js\async\677.9166d63a.js 0.46 kB 0.31 kB
dist\static\js\async\__federation_expose_button.3eb4437a.js 0.71 kB 0.46 kB
dist\mf-manifest.json 1.9 kB 0.48 kB
dist\mf-stats.json 2.1 kB 0.54 kB
dist\static\js\async\259.84da31e1.js 3.7 kB 1.4 kB
dist\static\js\async\987.1c234709.js 3.7 kB 1.4 kB
dist\static\js\index.7fe2f0d7.js 5.3 kB 2.3 kB
dist\static\js\async\512.f33d498f.js 7.5 kB 2.9 kB
dist\static\js\341.920f9f5e.js 75.1 kB 22.7 kB
dist\static\js\federation_provider.f3fd28c8.js 80.3 kB 24.2 kB
dist\static\js\async\339.9651f857.js 171.2 kB 54.5 kB
Total: 352.7 kB (gzip: 111.7 kB) I tried running the command npx tsc --project "C:\Projects\module-federation\federation_provider\node_modules.federation\tsconfig.640b668e9bc1c113939670178a7a6d19.json" as suggested in https://module-federation.io/guide/troubleshooting/type/TYPE-001 and I am not getting any error and the file 'federation_provider\dist@mf-types\compiled-types\button.d.ts' is generated. Trying to build or run dev again, the file is removed and the error occurs again. |
Describe the bug
GenerateTypesPlugin
is having trouble generating the zip file for@mf-types
.Replication is just bumping the plugins version to
0.3.3
of an rspack app from mf examples repo.Reproduction
https://github.com/module-federation/module-federation-examples/tree/master/rspack_hmr/app2
Used Package Manager
pnpm
System Info
Validations
The text was updated successfully, but these errors were encountered: