Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Commit

Permalink
v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gioboa committed Sep 22, 2022
1 parent 5993397 commit 7b2e242
Show file tree
Hide file tree
Showing 6 changed files with 1,125 additions and 88 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Change Log

All notable changes to this project will be documented in this file.

## version 0.2.0 - planet tasty (2022-09-22)

### Features

- hot module reload feature

## version 0.1.0 - planet tasty (2022-09-19)
35 changes: 5 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ You need to extend the Vite configuration with this plugin:
```typescript
import { defineConfig } from 'vite';
import { federation } from '@gioboa/vite-module-federation';
import { esBuildAdapter } from './module-federation/esbuild-adapter';
import { createEsBuildAdapter } from '@softarc/native-federation-esbuild';

// https://vitejs.dev/config/
export default defineConfig(async () => ({
Expand All @@ -41,7 +41,9 @@ export default defineConfig(async () => ({
federationConfig: 'module-federation/federation.config.cjs',
verbose: false,
},
adapter: esBuildAdapter,
adapter: createEsBuildAdapter({
plugins: [],
}),
}),
[...]
],
Expand All @@ -50,7 +52,7 @@ export default defineConfig(async () => ({

<br>

### Second step
### Define configs

You need to define two different configurations in the `federationConfig` property.<br>
Here two examples:
Expand All @@ -59,33 +61,6 @@ Here two examples:
- [remote](https://www.npmjs.com/package/@softarc/native-federation#configuring-remotes)
<br><br>

### Last step

As this plugin is tooling-agnostic, you need a simple adapter for your bundler, it's just a matter of one function.
Here an example:

```typescript
import type { BuildAdapter } from '@softarc/native-federation/build';
import * as esbuild from 'esbuild';

export const esBuildAdapter: BuildAdapter = async (options) => {
const { entryPoint, external, outfile } = options;

await esbuild.build({
entryPoints: [entryPoint],
external,
outfile,
bundle: true,
sourcemap: false,
minify: true,
format: 'esm',
target: ['esnext'],
});
};
```

<br>

### So far so good 🎉

Now you are ready to use Module Federation in Vite!
Loading

0 comments on commit 7b2e242

Please sign in to comment.