@module-federation/vite 0.2.8 → 1.0.0-alpha-7c3ba59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -40
- package/lib/index.cjs +489 -11015
- package/lib/index.d.ts +5 -2
- package/lib/index.esm.js +487 -11015
- package/lib/index.modern.js +538 -11000
- package/lib/index.umd.js +489 -11017
- package/lib/utils/aliasToArrayPlugin.d.ts +10 -0
- package/lib/utils/normalizeBuild.d.ts +8 -0
- package/lib/utils/normalizeModuleFederationOptions.d.ts +83 -0
- package/lib/utils/normalizeOptimizeDeps.d.ts +9 -0
- package/lib/utils/vitePluginAddEntry.d.ts +8 -0
- package/lib/utils/vitePluginOverrideModule.d.ts +6 -0
- package/package.json +9 -4
- package/lib/dev-externals-mixin.d.ts +0 -1
- package/lib/externals-skip-list.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Vite
|
|
1
|
+
# Vite plugin for Module Federation
|
|
2
2
|
|
|
3
3
|
## Reason why 🤔
|
|
4
4
|
|
|
@@ -10,64 +10,69 @@ This plugin makes Module Federation work together with [Vite](https://vitejs.dev
|
|
|
10
10
|
## Working implementations
|
|
11
11
|
|
|
12
12
|
### [React](https://github.com/module-federation/module-federation-examples/tree/master/vite-react-microfrontends)<br>
|
|
13
|
+
|
|
13
14
|
### [Svelte](https://github.com/module-federation/module-federation-examples/tree/master/vite-svelte-microfrontends)<br>
|
|
14
|
-
### [Vue](https://github.com/module-federation/module-federation-examples/tree/master/vite-vue-microfrontends)
|
|
15
15
|
|
|
16
|
+
### [Vue](https://github.com/module-federation/module-federation-examples/tree/master/vite-vue-microfrontends)
|
|
16
17
|
|
|
17
18
|
## Getting started 🚀
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
https://module-federation.io/guide/basic/webpack.html
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```typescript
|
|
22
|
+
```js
|
|
23
|
+
// vite.config.js
|
|
24
24
|
import { defineConfig } from 'vite';
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
25
|
+
import vue from '@vitejs/plugin-vue';
|
|
26
|
+
import { federation } from 'module-federation-vite';
|
|
27
|
+
import topLevelAwait from 'vite-plugin-top-level-await';
|
|
27
28
|
|
|
28
29
|
// https://vitejs.dev/config/
|
|
29
|
-
export default defineConfig(
|
|
30
|
-
server: {
|
|
31
|
-
fs: {
|
|
32
|
-
allow: ['.', '../shared'],
|
|
33
|
-
},
|
|
34
|
-
},
|
|
30
|
+
export default defineConfig({
|
|
35
31
|
plugins: [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
federation({
|
|
33
|
+
name: 'bbc',
|
|
34
|
+
remotes: {
|
|
35
|
+
mfapp01: 'mfapp01@https://unpkg.com/mf-app-01@1.0.9/dist/remoteEntry.js',
|
|
36
|
+
remote2: 'mfapp02@https://unpkg.com/mf-app-02/dist/remoteEntry.js',
|
|
37
|
+
remote3:
|
|
38
|
+
'remote1@https://unpkg.com/react-manifest-example_remote1@1.0.6/dist/mf-manifest.json',
|
|
39
|
+
// "remote4": {
|
|
40
|
+
// entry: "http://localhost:5174/dd/remoteEntry.js",
|
|
41
|
+
// globalEntryName: "bb",
|
|
42
|
+
// type: "esm"
|
|
43
|
+
// }
|
|
44
|
+
},
|
|
45
|
+
exposes: {
|
|
46
|
+
App: './src/App.vue',
|
|
47
|
+
},
|
|
48
|
+
filename: 'dd/remoteEntry.js',
|
|
49
|
+
shared: {
|
|
50
|
+
vue: {},
|
|
51
|
+
react: {
|
|
52
|
+
requiredVersion: '18',
|
|
53
|
+
},
|
|
44
54
|
},
|
|
45
|
-
adapter: createEsBuildAdapter({ plugins: [...], }),
|
|
46
55
|
}),
|
|
47
|
-
|
|
56
|
+
// If you set build.target: "chrome89", you can remove this plugin
|
|
57
|
+
// topLevelAwait(),
|
|
48
58
|
],
|
|
49
|
-
|
|
59
|
+
build: {
|
|
60
|
+
target: 'chrome89',
|
|
61
|
+
},
|
|
62
|
+
});
|
|
50
63
|
```
|
|
51
64
|
|
|
52
|
-
|
|
65
|
+
## roadmap
|
|
53
66
|
|
|
54
|
-
|
|
67
|
+
- feat: generate mf-manifest.json
|
|
68
|
+
- feat: support chrome plugin
|
|
55
69
|
|
|
56
|
-
|
|
57
|
-
Here are two examples:
|
|
70
|
+
* ✅ ~~feat: support runtime plugins~~
|
|
58
71
|
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
|
|
72
|
+
- feat: download remote d.ts
|
|
73
|
+
- feat: generate d.ts
|
|
74
|
+
- feat: support @vitejs/plugin-legacy
|
|
62
75
|
|
|
63
76
|
### So far so good 🎉
|
|
64
77
|
|
|
65
78
|
Now you are ready to use Module Federation in Vite!
|
|
66
|
-
|
|
67
|
-
## Thanks 🤝
|
|
68
|
-
|
|
69
|
-
Big thanks to:
|
|
70
|
-
|
|
71
|
-
[Manfred Steyer](https://twitter.com/manfredsteyer), Speaker, Trainer, Consultant and Author with focus on Angular. Google Developer Expert (GDE) and Microsoft MVP.
|
|
72
|
-
|
|
73
|
-
who collaborate with me to make this possible.
|