Closed crutch12 closed 1 month ago
I still do not understand why not use the built in type system?
@ScriptedAlchemy how can I use built in type system with vite?
It supports only rspack/webpack, doesn't it?
So I use vite-plugin-federation
+ @module-federation/native-federation-typescript
Once esbuild is merged i will be moving onto vite/rolldown integration. Esbuild we will include type since and pretty much everything else we can support on weaker bundler tech. But yes i understand the issue now
Okay, waiting for esbuild
implementation (https://github.com/module-federation/core/pull/2473)
But @module-federation/native-federation-typescript
is great, could be cool if we could use it as CLI
/programmatically
# CLI
$ npx @module-federation/native-federation-typescript generate-host
or/and
// programmatically
import { generateHost } from '@module-federation/native-federation-typescript'
await generateHost({ /* ... */ })
Now, for programming usage, I use esbuild
plugin :D
const esbuild = require('esbuild');
const { NativeFederationTypeScriptHost } = require('@module-federation/native-federation-typescript/esbuild');
const generate = () => esbuild.build({
plugins: [
NativeFederationTypeScriptHost({
/* ... */
}),
],
});
module.exports.generate = generate
@ScriptedAlchemy I'll wait for your feedback here. If it's something that is worth to be implemented I can do it, but if it will be thrown away shortly maybe it's just better to wait
About the requested features, atm the plugin is made to be compatible with the "standard" module federation (e.g. the one embedded with Webpack) so I would avoid inserting the support for the manifest because as Zack said it will be available in the near feature officially. But I can work on make it available without it. I'll wait for Zack's feedback first.
Im unsure on timeline on supporting esbuild but i know this is the intention once others work, to try and make them work with other implementations as well. If we want at least a mid term solution - it might be updating the plugin.
@ilteoood have you looked at our TS impl in DTS manager? im wondering if we could hook into the internals of it like dts or the broker? I wonder if we are able to use some of the lower parts of the system to share capabilites
Stale issue message
Clear and concise description of the problem
Hi @ilteoood 👋
It would be great to have more flexibility in
@module-federation/native-federation-typescript
pluginHere are my comments:
NativeFederationTypeScriptRemote
typesFolder: './types/@my-mf-types'
(nested) generates empty./dist/types
folder@module-federation/enhanced/webpack
(or@module-federation/manifest
), this plugin doesn't changemf-manifest.json
file. Example:plugins: [ new ModuleFederationPlugin({ ...federationConfig, dts: false, // disable to generate with NativeFederationTypeScriptRemote }), NativeFederationTypeScriptRemote({ moduleFederationConfig: federationConfig, typesFolder: './types/@my-mf-types', }), ],
// generated mf-manifest.json // ... "metaData": { // ... "types": { "path": "", "name": "", "zip": "", "api": "" }, }, // ...
OR/AND
Take
@mf-types.zip
path frommf-manifest.json
(types
section`). Example:Alternative
No response
Additional context
No response
Validations