@@ -39,7 +39,7 @@ lang: zh-CN
39
39
::: tip
40
40
子应用打包成 UMD 格式的主要原因是为了维护一个统一的 webpack build context。主运行时在 PRD 上跑的是 webpack 构建后的 bundle 代码,而子应用也支持被独立构建,那么变成了两个独立的 webpack build context 构建生成的 bundle。当时没有找到好的解决办法,所有用 UMD 上了。而后续在写 ` VueMfe.Lazy ` 的时候看到了社区有一种实现方式是使用 XHR 把 JS 文件请求到后使用 ` new Function(require, exports, ${ XHRResponse.bodyText }) ` 拼接后执行。类似这样 [ httpVueLoader ScriptContext.compile] ( https://github.com/FranckFreiburger/http-vue-loader/blob/master/src/httpVueLoader.js#L161 ) ,但感觉还是没有 UMD 简单方便。
41
41
:::
42
- - build 的入口** 必须是执行 ` VueMfe.createApp ` 的文件** 。 (因为该资源会被 [ loader] ( https://github.com/vuchan /vue-mfe/blob/master/src/helpers/loader.js#L15 ) 通过 UMD 的暴露的全局变量动态装载。
42
+ - build 的入口** 必须是执行 ` VueMfe.createApp ` 的文件** 。 (因为该资源会被 [ loader] ( https://github.com/givingwu /vue-mfe/blob/master/src/helpers/loader.js#L15 ) 通过 UMD 的暴露的全局变量动态装载。
43
43
::: warning
44
44
路由的根路由必须以 ` /${prefix}/ ` 开始,且 ` ${prefix} ` 不能存在与另一 SubApp 的 prefix 重复,否则会抛出 ` registerRoutes ` 失败的错误。
45
45
:::
@@ -50,7 +50,7 @@ lang: zh-CN
50
50
51
51
### createApp
52
52
53
- ` VueMfe.createApp({}: AppConfig): void ` 创建 VueMfe 主(基座)应用,后续所有的 SubApp 都将被注册和装载到该应用。 [ source code] ( https://github.com/vuchan /vue-mfe/blob/master/src/index.js#L41 )
53
+ ` VueMfe.createApp({}: AppConfig): void ` 创建 VueMfe 主(基座)应用,后续所有的 SubApp 都将被注册和装载到该应用。 [ source code] ( https://github.com/givingwu /vue-mfe/blob/master/src/index.js#L41 )
54
54
55
55
``` javascript {38}
56
56
import VueMfe from ' vue-mfe'
@@ -100,7 +100,7 @@ export default VueMfe.createApp({
100
100
101
101
### createSubApp
102
102
103
- ` SubAppConfig: createSubApp({}: SubAppConfig) ` 创建一个 VueMfe SubApp 子应用。可以暴露任意组件给其他应用(App 和 SubApp)使用。[ source code] ( https://github.com/vuchan /vue-mfe/blob/master/src/index.js#L84 )
103
+ ` SubAppConfig: createSubApp({}: SubAppConfig) ` 创建一个 VueMfe SubApp 子应用。可以暴露任意组件给其他应用(App 和 SubApp)使用。[ source code] ( https://github.com/givingwu /vue-mfe/blob/master/src/index.js#L84 )
104
104
105
105
``` javascript {26}
106
106
import VueMfe from ' vue-mfe'
@@ -157,7 +157,7 @@ export default VueMfe.createSubApp({
157
157
158
158
### isInstalled
159
159
160
- ` VueMfe.isInstalled(prefix: string): boolean ` 当前应用是否已被安装过。 [ source code] ( https://github.com/vuchan /vue-mfe/blob/master/src/core/app/status.js#L10 )
160
+ ` VueMfe.isInstalled(prefix: string): boolean ` 当前应用是否已被安装过。 [ source code] ( https://github.com/givingwu /vue-mfe/blob/master/src/core/app/status.js#L10 )
161
161
162
162
``` javascript
163
163
import VueMfe from ' vue-mfe'
@@ -171,7 +171,7 @@ if (VueMfe.isInstall('prefix')) {
171
171
172
172
### Lazy
173
173
174
- ` VueMfe.Lazy(path: string): Promise<any> ` 远程加载一个 Module,可以是任意合法的 JavaScript 对象。[ source code] ( https://github.com/vuchan /vue-mfe/blob/master/src/core/lazy.js#L25 )
174
+ ` VueMfe.Lazy(path: string): Promise<any> ` 远程加载一个 Module,可以是任意合法的 JavaScript 对象。[ source code] ( https://github.com/givingwu /vue-mfe/blob/master/src/core/lazy.js#L25 )
175
175
176
176
::: warning
177
177
在 VueMfe.Lazy 被其他 SubApp 调用之前,SubApp Demo 必须先暴露 Example 组件并打包成 UMD 格式并配置到 App Resource 中。
@@ -225,13 +225,13 @@ export default {
225
225
226
226
## DEMO
227
227
228
- - [ App] ( https://github.com/vuchan /vue-mfe/blob/master/example/root-app/src/main.js )
229
- - [ SubApp] ( https://github.com/vuchan /vue-mfe/blob/master/example/sub-app-demo/main.js )
230
- - [ Lazy] ( https://github.com/vuchan /vue-mfe/blob/master/example/sub-app-lazy/src/views/async.vue )
228
+ - [ App] ( https://github.com/givingwu /vue-mfe/blob/master/example/root-app/src/main.js )
229
+ - [ SubApp] ( https://github.com/givingwu /vue-mfe/blob/master/example/sub-app-demo/main.js )
230
+ - [ Lazy] ( https://github.com/givingwu /vue-mfe/blob/master/example/sub-app-lazy/src/views/async.vue )
231
231
232
232
``` bash
233
233
# pull repo
234
- git clone https://github.com/vuchan /vue-mfe.git
234
+ git clone https://github.com/givingwu /vue-mfe.git
235
235
cd vue-mfe
236
236
237
237
# 安装依赖
0 commit comments