All Projects → CHU295 → Micro Frontends Practice

CHU295 / Micro Frontends Practice

基于qiankun的微前端实践,提供更为简单、完整的项目。react/vue demo已完成

Programming Languages

javascript
184084 projects - #8 most used programming language
js
455 projects

Projects that are alternatives of or similar to Micro Frontends Practice

Mina Webpack
🍱 Mina single-file-component meets Webpack
Stars: ✭ 77 (-7.23%)
Mutual labels:  webpack
Alias Hq
The end-to-end solution for configuring, refactoring, maintaining and using path aliases
Stars: ✭ 77 (-7.23%)
Mutual labels:  webpack
Spa Starter Kit
📦 Quick starter kit for booting up a NodeJS container with React, webpack, babel/ES2015, Redux, and more.
Stars: ✭ 81 (-2.41%)
Mutual labels:  webpack
Vue H5 Pro
🚀 基于@vue/CLI3构建的移动端h5项目模板
Stars: ✭ 78 (-6.02%)
Mutual labels:  webpack
Vue Ssr
基于vue-ssr搭建的一套node服务端渲染工作流
Stars: ✭ 78 (-6.02%)
Mutual labels:  webpack
React Router Animation Examples
An example using React Router and React's Animations
Stars: ✭ 80 (-3.61%)
Mutual labels:  webpack
Polled.win
📊 Real time polling
Stars: ✭ 76 (-8.43%)
Mutual labels:  webpack
Hactar
The solution to JavaScript Fatigue. Zero config dev
Stars: ✭ 82 (-1.2%)
Mutual labels:  webpack
Webpack React
👍👏react入门,抛砖引玉
Stars: ✭ 79 (-4.82%)
Mutual labels:  webpack
Semaphore Ng2 Webpack
Stars: ✭ 81 (-2.41%)
Mutual labels:  webpack
Mostly
They mostly come at night; mostly.
Stars: ✭ 78 (-6.02%)
Mutual labels:  webpack
Vue Md Loader
✨ Markdown files to ALIVE Vue components.
Stars: ✭ 78 (-6.02%)
Mutual labels:  webpack
Page Builder
自定义页面构建平台
Stars: ✭ 81 (-2.41%)
Mutual labels:  webpack
Angular2 Demo
A simple demo for Angular 2
Stars: ✭ 77 (-7.23%)
Mutual labels:  webpack
Easy Pack
Webpack, Ahhhhhhh .... Take Easy
Stars: ✭ 82 (-1.2%)
Mutual labels:  webpack
Mern
🎉 This is boilerplate for MERN stack with integrations like Redux and SSR 🎉
Stars: ✭ 77 (-7.23%)
Mutual labels:  webpack
Jhipster5 Demo
Get Started with JHipster 5 Tutorial and Example
Stars: ✭ 80 (-3.61%)
Mutual labels:  webpack
Web React
💠 Another React Dev Kit with Webpack and NodeJS
Stars: ✭ 82 (-1.2%)
Mutual labels:  webpack
React Webpack Babel
Simple React Webpack Babel Starter Kit
Stars: ✭ 1,241 (+1395.18%)
Mutual labels:  webpack
Multi Page App With React
🔧 A lightweight, flexible webpack setup with React for multi page application development
Stars: ✭ 82 (-1.2%)
Mutual labels:  webpack

微前端实践

基于qiankun(https://github.com/umijs/qiankun)

主要细化qiankun example,希望我踩过的坑大家能跳过去,节省时间~

根据qiankun更新进度不定时修改完善

有帮助的话别忘了start(https://github.com/CHU295/Micro-Frontends-practice)

目录介绍

项目目前编写了vue、react两种实现方式

根项目:main_react / main_vue

子项目:react_ / react_eject / vue / react_webpack

五个项目独立存在

请先运行子项目,再运行父项目

  • 一、main_react

根项目 create-react-app版本

  1. 安装qiankun,yarn add qiankun # or npm i qiankun -S

可选isomorphic-fetch

  1. 修改src/App.js创建qiankun主框架
  • 二、main_vue

根项目 vue-cli搭建版本

  1. 安装qiankun,yarn add qiankun # or npm i qiankun -S

可选isomorphic-fetch

  1. 修改src/main.js创建qiankun主框架
  • 三、react_

子项目 create-react-app版本

采用react-app-rewired修改webpack相关配置

  1. 安装react-app-rewired

npm install react-app-rewired --save-dev

  1. 修改package.josn文件scripts命令,替换react-scripts为react-app-rewired
"scripts": {
  "start": "react-app-rewired start",
  "build": "react-app-rewired build",
  "test": "react-app-rewired test",
  "eject": "react-scripts eject"
},
  1. 添加 config-overrides.js 文件到根目录

可添加.env配置端口等等

  1. 修改src/index.js导入生命周期
  • 四、react_eject

子项目 create-react-app版本

与上一个不同,本项目使用eject命令展开了默认配置

  1. 修改src/index.js导入生命周期
  2. 修改config/webpack.config.js,output新增参数。注意参数写法
library: `${appPackageJson.name}-[name]`,
libraryTarget: 'umd',
jsonpFunction: `webpackJsonp_${appPackageJson.name}`,
  1. 按需修改config/webpackDevServer.config.js,一般只需添加header允许跨域等等
headers: {
  'Access-Control-Allow-Origin': '*',
},
  • 五、vue

子项目 vue-cli搭建版本

  1. vue-cli生成后根目录添加vue.config.js文件
  2. 修改src/main.js导入生命周期
  • 六、react_webpack

子项目 webpack 简易搭建的react项目

特殊说明

  1. 注意挂载的节点id,子父不得同名。 例:子父皆为react项目,同时挂在到#root

雷点

  1. 运行过程中修改create-react-app子项目,强刷根项目可能会报错缺少生命周期,重启子项目即可
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].