npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-vue-micro-frame

v0.1.7

Published

react-vue-micro-frame

Downloads

25

Readme

English | 简体中文

React micro-frontends component that loads vue

  This is a single-spa based react micro front-end component

  I have a dream, I hope that can load a components of other frameworks as simple as loading a <iframe> tag in a react project.

Experience an demo

git clone [email protected]:y805939188/react-vue-micro-frame.git
cd react-vue-micro-frame
npm install
npm run start

How to use

npm install --save react-vue-micro-frame
  /** Load remote components **/
  import React from 'react';
  import VueFrame from 'react-vue-micro-frame';
  const Test = () => (
    <div>
      <VueFrame jsurl="http://originPath/vueComponent.umd.js"/>
    </div>
  )
  /** Load local components **/
  import React from 'react';
  import VueFrame from 'react-vue-micro-frame';
  import VueComponent from './vueComponent.vue';
  const Test = () => (
    <div>
      <VueFrame componet={VueComponent} />
    </div>
  )
  /** You can also load a remote react component **/
  import React from 'react';
  import { ReactFrame } from 'react-vue-micro-frame';
  const Test = () => (
    <div>
      <ReactFrame jsurl="http://reactComponentAddress.umd.js" />
    </div>
  )

  NOTE: Components development must use the umd specification.   I recommend using "vue-cli" to write a "vue" component.   How to write a "vue" component with use "vue-cli"   And you can use the elf-cli to easily create a react component that meets the umd.

Parameter

Only jsurl or component attributes are required, other parameters are optional | parameter | type | need | features | |:-|:-|:-|:-| | jsurl | string | jsurl and component must be one of two | js script of the remote vue or react component | | component | VueComponent | jsurl and component must be one of two | local vue component | | extraProps | Object | not necessary | properties passed to the component | | visible | boolean | not necessary | whether to show component | | cssurl | string | not necessary | The address of the remote css. If determine that this address has a css file, you can use this property | | name | string | not necessary | The name of the remote component | | loadType | 'xhr' or 'script' | not necessary | The way to load remote components, using xhr has cross-domain risks. When there is cross-domain risks, it will be forced to use script loading. |

Feature

  • [x] Load remote vue components
  • [x] Load local vue or react components
  • [x] Cross domain loading
  • [x] Static resource loading
  • [x] css style isolation

TODO

  • [ ] Research if the component can be refactor with qiankun2.x
  • [ ] Load the entire vue/react application from origin
  • [ ] Render content to outside of the micro-frame. (At present, because of the react-vue-micro-frame be wrote with reference to primordial , so the component can not render content to outside)
  • [ ] design a pipeline to communication between the micro-frame and outside components. (This is necessary for scenarios with external using state management e.g. redux)

Potential problem

  1. The style isolation uses the shadow dom method, so temporarily does not support ie
  2. Static resources only support resources that are loaded through the src attribute, such as image and other resources, without any processing. For resources like ttf, there may be cross-domain situations.
  3. vue-cli will extract the css file separately by default, you can load the remote css through the cssurl property, or you can put the css into the js file by inline:
/** vue-cli's vue.config.js */
module.exports = {
  css: {
    extract: false,
  },
}
  1. Please try and mention more bugs, I will continue to improve. If it is convenient, please give a star by the way.