1.0.2 • Published 5 months ago
@airelogic/vite-plugin-module-federation-remote-types v1.0.2
module-federation-remote-types/module-federation-remote-types/README.md
Module Federation Remote Types
This project provides a Vite plugin called moduleFederationRemoteTypes
that facilitates the downloading of remote types for module federation in a micro-frontend architecture.
Installation
To use this plugin, you need to install it via npm. Run the following command in your project directory:
npm install module-federation-remote-types
Usage
To use the moduleFederationRemoteTypes
plugin in your Vite configuration, import it and add it to your plugins array:
import { defineConfig } from 'vite';
import { moduleFederationRemoteTypes } from 'module-federation-remote-types';
export default defineConfig({
plugins: [
moduleFederationRemoteTypes({
remotes: {
// Define your remote configurations here
remoteName: 'http://remote-url/manifest.json',
},
dts: {
generateTypes: {
typesFolder: '@mf-types',
deleteTypesFolder: true,
},
},
}),
],
});
Options
The moduleFederationRemoteTypes
function accepts an options object with the following properties:
remotes
: An object where keys are remote names and values are the URLs to their manifest files.dts
: An optional object to configure TypeScript definitions generation. It can include:generateTypes
: An object to specify options for generating types, including:typesFolder
: The folder where types will be downloaded.deleteTypesFolder
: A boolean indicating whether to delete the types folder before downloading.
Development
To build the project, run:
npm run build
For development, you can use:
npm run dev
License
This project is licensed under the MIT License. See the LICENSE file for more details.