qiankun 实战 demo,父应用 vue,子应用使用 react
, vue
和 原生HTML
。
安装根目录工程依赖
npm i
一键安装所有主子应用的依赖
npm run install
一键启动所有所有应用
npm start
通过 http://localhost:8080/ 访问主应用。
一键构建并打包所有主子应用
npm run build
🚀 qiankun实战demo,父应用vue,子应用用react和vue
Home Page: http://qiankun.fengxianqi.com/
qiankun 实战 demo,父应用 vue,子应用使用 react
, vue
和 原生HTML
。
安装根目录工程依赖
npm i
一键安装所有主子应用的依赖
npm run install
一键启动所有所有应用
npm start
通过 http://localhost:8080/ 访问主应用。
一键构建并打包所有主子应用
npm run build
你好,build之后我在ngixn配置了部署,可以打开主应用和子应用,
但是打开子应用之后点击浏览器的刷新按钮子应用就找不到了,页面一片空白
若项目有CI/CD,只修改了某个子应用的代码,但代码提交会同时触发所有子应用构建,牵一发动全身,是不合理的。
请问,独立仓库之后,基座怎么取子应用呢(子应用打包完成后, 怎么放到基座中?)。
webpack-dev-server --progress --colors --hot --inline --content-base ./dis
比如 sub-vue 中配置了 lint-staged 需要依赖git
但是.git 在上层目录
进入 sub-vue 目录 运行lint-staged 会报当前current directory is not a git directory!
这种怎么处理
运行npm run start会自动打开浏览器打开子应用react项目页面,http://localhost:7788/subapp/sub-react。希望自动打开的为http://localhost:8080/ 主应用
请教一下 代码报错 Uncaught TypeError: application 'sub-vue' died in status LOADING_SOURCE_CODE: Failed to fetch
application 'sub-vue' died in status LOADING_SOURCE_CODE: Failed to fetch
我想要使用 loadMicroApp
来手动启动 react 子应用,我的做法如下:
microApps
中注册的 React 微应用信息const microApps = [
{
name: 'sub-vue',
entry: process.env.VUE_APP_SUB_VUE,
activeRule: '/sub-vue'
},
// {
// name: 'sub-react',
// entry: process.env.VUE_APP_SUB_REACT,
// activeRule: '/sub-react'
// },
{
name: 'sub-html',
entry: process.env.VUE_APP_SUB_HTML,
activeRule: '/sub-html'
}
]
<template>
<div ref="reactContainer"></div>
</template>
<script>
import { loadMicroApp } from 'qiankun'
export default {
mounted () {
loadMicroApp({
name: 'sub-react',
entry: process.env.VUE_APP_SUB_REACT,
container: this.$refs.reactContainer
})
}
}
</script>
<ReactSub v-if="showReact"></ReactSub>
<button @click="changeShowReact">挂载 React</button>
changeShowReact () {
this.showReact = !this.showReact
},
遇到的问题如下
showReact
变量初始化为 true
,这种情况下则能够成功挂载该子应用。git submodule和git subtree都是很好的子仓库管理方案,但缺点是每次子应用变更后,聚合库还得同步一次变更。
这个是不是就不在场景使用了,看了下gitsubmoudle使用都是在一个仓库里使用子应用使用elemenui框架那种dialog或者抽屉组件,遮罩层挂载到了父应用的body,子应用的实际内容被遮罩层遮住,这种要怎么处理,如果只挂载的子组件本身,那父应用,一些公共的地方又没遮住
麻烦作者在readme中写下node环境,我本地node-v :v18.15.0。启动时会抛出异常
//sub-vue\src\main.js
import { store as commonStore } from 'common'
在node_modules:/qiankun-example/sub-vue/node_modules/common/src/index"路径中可以找到
请问下common库是自定义的吗?
如果是,有如下问题想请教下:
细节描述, 初始化 的菜单是可以进去的 ,但是其他菜单切换 就是进不去,但是切换到 初始化菜单本身没有问题
有人知道什么原因吗,开发环境下基座的跨域代理应该怎么
项目里把GlobalState封装到了common项目里,sub-vue进行了引用。但是在react和jquery的html项目里可以引用吗?具体怎么用,特别是jquery的html项目中
步骤:
错误信息:
Uncaught Error: application 'sub-react' died in status LOADING_SOURCE_CODE: [qiankun] You need to export lifecycle functions in sub-react entry
其他:
重新start react子应用 页面可以正常展示
这边是热更新的问题吗
按照部署过程操作后,无法启动
错误信息
available via npm run-script
:
install:main
cd main && npm i
install:sub-vue
cd sub-vue && npm i
start:sub-vue
cd sub-vue && npm start
start:main
cd main && npm start
start:sub-html
cd sub-html && npm start
build
npm-run-all build:* && bash ./scripts/bundle.sh
build:sub-vue
cd sub-vue && npm run build
build:sub-html
cd sub-html && npm run build
build:main
cd main && npm run build
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.