# Try the newer example repo
The newer example demonstrating Vue Microfrontends can be found at https://github.com/vue-microfrontends and https://vue.microfrontends.app. That example better reflects the microfrontends architecture and is encouraged to use.
# Coexisting Vue Microfrontends
[![Build Status](https://travis-ci.org/joeldenning/coexisting-vue-microfrontends.svg?branch=master)](https://travis-ci.org/joeldenning/coexisting-vue-microfrontends)
Demo: http://coexisting-vue-microfrontends.surge.sh
This is a starter-kit / example repository for people who want to have multiple vue microfrontends coexist within a single page. Each
of the vue applications was created by Vue CLI.
It uses [single-spa](https://single-spa.js.org) to pull this off, which means that you can even add React, Angular, or other frameworks as
additional microfrontends.
## An important note
This github repository has four projects all in one repo. But when you do this yourself, **you'll want to have one git repo per
vue application**. The root-html-file project should also be in its own repo. This is what lets different teams and developers be in
charge of different microfrontends.
## Local development -- one app at a time
[Tutorial video](https://www.youtube.com/watch?v=vjjcuIxqIzY&list=PLLUD8RtHvsAOhtHnyGx57EYXoaNsxGrTU&index=4)
With single-spa, it is preferred to run `npm run serve` in only one single-spa application at a time, while using a deployed
version of the other applications. This makes for an awesome developer experience where you can boot up just one
microfrontend at a time, not even having to clone, npm install, or boot up all of the other ones.
To try this out, clone the repo and run the following commands:
```sh
cd app1
npm i
npm run serve
```
Now go to http://coexisting-vue-microfrontends.surge.sh in a browser. In a browser console, run `localStorage.setItem('overrides-ui', true)`.
Refresh the page. Now click on the yellowish rectangle at the bottom right. Then click on `app1`. Change the module url to http://localhost:8081/js/app.js. Then apply the override and reload the page. This will have change app1 to load from your localhost instead of from surge.sh.
As you modify the code locally, it will reload the page on coexisting-vue-microfrontends.surge.sh. See
https://github.com/joeldenning/import-map-overrides for more info on this.
## Local development -- all at once
It is preferred to only run one app at a time. But if you need to run them all locally, you can do so with the following instructions
```sh
# First terminal tab
cd root-html-file
npm install
npm run serve
```
```sh
# Second terminal tab
cd app1
npm install
npm run serve
```
```sh
# Third terminal tab
cd app2
npm install
npm run serve
```
```sh
# Fourth terminal tab
cd navbar
npm install
npm run serve
```
Now go to http://localhost:5000 in a browser. Note that you can change any of the ports for the projects by modifying the Import Map inside of
root-html-file/index.html.
If you get serious about deploying your code, you'll want to make it no longer necessary to boot up all of the apps in order to do anything.
When you get to that point, check out [import-map-overrides](https://github.com/joeldenning/import-map-overrides/), which lets you go to
a deployed environment and override the [Import Map](https://github.com/WICG/import-maps) for just one microfrontend at a time. The
import-map-overrides library is already loaded in the index.html of root-html-file, so you can start using it immediately. You can make your
deployed environment overridable, just like you can do overrides on http://coexisting-vue-microfrontends.surge.sh
## More documentation
Go to https://single-spa.js.org/docs/ecosystem-vue.html to learn how all of this works.
没有合适的资源?快使用搜索试试~ 我知道了~
一个 repo,展示了单独的 Vue 应用作为微前端与 Single-spa 共存.zip
共61个文件
js:18个
vue:8个
json:8个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 128 浏览量
2024-12-02
01:03:19
上传
评论
收藏 261KB ZIP 举报
温馨提示
一个 repo,展示了单独的 Vue 应用作为微前端与 Single-spa 共存尝试更新的示例 repo演示 Vue Microfrontends 的较新示例可在https://github.com/vue-microfrontends和https://vue.microfrontends.app找到。该示例更好地反映了微前端架构,鼓励使用。共存的 Vue 微前端演示http://coexisting-vue-microfrontends.surge.sh这是一个入门套件/示例存储库,适用于希望在单个页面中共存多个 vue 微前端的人。每个 vue 应用程序都是由 Vue CLI 创建的。它使用single-spa来实现这一点,这意味着你甚至可以添加 React、Angular 或其他框架作为额外的微前端。重要提示这个 github 存储库有四个项目,全部放在一个存储库中。但是当您自己执行此操作时,您需要每个 vue 应用程序都有一个 git 存储库。root-html-file 项目也应该在其自己的存储库中。这样就可以让不同的团队和开发人员负责不同的微
资源推荐
资源详情
资源评论
收起资源包目录
一个 repo,展示了单独的 Vue 应用作为微前端与 Single-spa 共存.zip (61个子文件)
app2
.browserslistrc 21B
babel.config.js 73B
src
App.vue 347B
assets
logo.png 7KB
main.js 436B
components
HelloWorld.vue 456B
set-public-path.js 82B
views
Home.vue 323B
About.vue 89B
router.js 551B
package.json 565B
public
favicon.ico 4KB
index.html 545B
package-lock.json 396KB
vue.config.js 585B
.gitignore 214B
README.md 357B
postcss.config.js 59B
app1
.browserslistrc 21B
babel.config.js 73B
src
App.vue 349B
assets
logo.png 7KB
main.js 436B
components
HelloWorld.vue 2KB
set-public-path.js 82B
views
Home.vue 361B
router.js 241B
package.json 565B
public
favicon.ico 4KB
index.html 545B
package-lock.json 396KB
vue.config.js 584B
.gitignore 214B
README.md 357B
postcss.config.js 59B
navbar
.browserslistrc 21B
babel.config.js 73B
src
App.vue 543B
assets
logo.png 7KB
main.js 436B
set-public-path.js 84B
router.js 545B
package.json 567B
public
favicon.ico 4KB
index.html 549B
package-lock.json 396KB
vue.config.js 585B
.gitignore 214B
README.md 359B
postcss.config.js 59B
.travis.yml 1KB
.github
FUNDING.yml 647B
标签.txt 3B
Makefile 1KB
LICENSE 1KB
资源内容.txt 1003B
root-html-file
package.json 134B
package-lock.json 22KB
index.html 3KB
.gitignore 921B
README.md 4KB
共 61 条
- 1
资源评论
徐浪老师
- 粉丝: 8284
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- burp24-jdk-21.0.2
- 施工人员检测38-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord、VOC数据集合集.rar
- burp-proxy-tools
- 施工人员检测37-YOLOv7、COCO、CreateML、Darknet、Paligemma、VOC数据集合集.rar
- 嵌入式系统课程设计:基于51单片机的温度检测系统实现
- BurpLoaderKeygen
- 工具变量-A股上市公司企业盟浪esg评级数据(2018-2022年).xlsx
- 施工人员检测26-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord、VOC数据集合集.rar
- springboot靓车汽车销售网站(代码+数据库+LW)
- java区块链项目模块代码.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功