Giter Club home page Giter Club logo

vue-cli-plugin-qiankun's Introduction

vue-cli-plugin-qiankun

qiankun plugin for vue-cli

npm version npm downloads

使用步骤 (Use setup)

  1. 创建主应用 (Create master project)
$ vue create master
$ cd master
$ vue add vue-cli-plugin-qiankun --type master
  1. 创建子应用 (Create slave project)
$ vue create foo-app
$ cd foo-app
$ vue add vue-cli-plugin-qiankun --type slave --port 8081
  1. 配置主应用 (Config master project)

master/src/App.vue

<script>
export default {
  name: 'master',
  data () {
    return {
      // ...
      apps: [
        { name: 'foo-app', entry: '//localhost:8081', container: '#appContainer', activeRule: '/foo-app' }
      ]
    }
  },
  // ...
  methods: {
    // ...
    initQiankun () {
      // ...
      setDefaultMountApp('/foo-app')
      // ...
    }
  }
}
</script>
  1. 运行各项目 (Run each project)
$ cd master
$ yarn serve
$ cd foo-app
$ yarn serve

示例 (Examples)

DEMO

$ cd examples
$ yarn
$ yarn install:all
$ yarn serve:all

功能 (Features)

  • 修改项目文件引入 qiankun 框架

  • 注入 qiankun 框架要求的构建配置

  • 自动配置 publicPath 处理资源路径

致谢 (Acknowledgements)

  • vue-cli Standard Tooling for Vue.js Development.

  • qiankun Blazing fast, simple and completed solution for micro frontends.

  • single-spa What an awesome meta-framework for micro-frontends!

vue-cli-plugin-qiankun's People

Contributors

f-loat avatar yangdengcheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-cli-plugin-qiankun's Issues

在对应子模块下刷新的问题

比如在/foo-app下刷新,那么浏览器就直接加载foo-app项目了,而不是通过我们的portal中去加载foo-app子模块了。

不刷新还好,一刷新,浏览器选择的入口就变了。

mounted方法调用两次

$ vue create foo-app
$ cd foo-app
$ vue add vue-cli-plugin-qiankun --type slave --port 8081

按照这个步骤创建子应用,mounted方法调用两次,如果不安装vue-cli-plugin-qiankun插件,则没有问题

安装不了依赖。

首先感谢你的deom,但是有个问题,我一直安装不了依赖,比如饿了么的ui

examples里的子项目报eslint的错误. 我确定eslint都是被安装过的

Module build failed (from ./node_modules/eslint-loader/index.js):
[1] Error: No ESLint configuration found.
[1] at Config.getLocalConfigHierarchy (H:\ceshi\vue-cli-plugin-qiankun\examples\foo-app\node_modules\eslint\lib\config.js:268:39)
[1] at Config.getConfigHierarchy (H:\ceshi\vue-cli-plugin-qiankun\examples\foo-app\node_modules\eslint\lib\config.js:192:43)
[1] at Config.getConfigVector (H:\ceshi\vue-cli-plugin-qiankun\examples\foo-app\node_modules\eslint\lib\config.js:299:21)
[1] at Config.getConfig (H:\ceshi\vue-cli-plugin-qiankun\examples\foo-app\node_modules\eslint\lib\config.js:342:29)
[1] at processText (H:\ceshi\vue-cli-plugin-qiankun\examples\foo-app\node_modules\eslint\lib\cli-engine.js:181:33)
[1] at CLIEngine.executeOnText (H:\ceshi\vue-cli-plugin-qiankun\examples\foo-app\node_modules\eslint\lib\cli-engine.js:690:40)
[1] at lint (H:\ceshi\vue-cli-plugin-qiankun\examples\foo-app\node_modules\eslint-loader\index.js:278:17)
[1] at transform (H:\ceshi\vue-cli-plugin-qiankun\examples\foo-app\node_modules\eslint-loader\index.js:252:18)
[1] at H:\ceshi\vue-cli-plugin-qiankun\examples\foo-app\node_modules\loader-fs-cache\index.js:127:18
[1] at ReadFileContext.callback (H:\ceshi\vue-cli-plugin-qiankun\examples\foo-app\node_modules\loader-fs-cache\index.js:31:14)
[1] at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:239:13)

application 'foo-app' died in status LOADING_SOURCE_CODE: Failed to fetch

$ cd examples
$ yarn
$ yarn install:all
$ yarn serve:all

你好,我运行以上4句后,打开F12,控制台报错信息如下:

Failed to load resource: net::ERR_EMPTY_RESPONSE
Uncaught TypeError: application 'foo-app' died in status LOADING_SOURCE_CODE: Failed to fetch

单独运行两个子项目是ok的
请问有解决的方式吗?谢谢

引用组件路径过长问题

在子应用使用主应用的组件或者方法,使用相对路径来引用,路径过长容易写错,有没有好的解决办法

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.