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

@alleyway-boop/micro-app

v1.0.0-rcc.16

Published

A lightweight, efficient and powerful micro front-end framework

Downloads

73

Readme

English|简体中文|官网文档讨论组微信群

📖简介

micro-app是京东零售推出的一款微前端框架,它基于类WebComponent进行渲染,从组件化的思维实现微前端,旨在降低上手难度、提升工作效率。它是目前接入微前端成本最低的框架,并且提供了JS沙箱、样式隔离、元素隔离、预加载、虚拟路由系统、插件系统、数据通信等一系列完善的功能。

micro-app与技术栈无关,对前端框架没有限制,任何框架都可以作为基座应用嵌入任何类型的子应用。

如何使用

主应用

1、安装依赖

yarn add @micro-zoe/micro-app

2、在入口文件引入

// main.js
import microApp from '@micro-zoe/micro-app'

microApp.start()

3、在页面中嵌入微前端应用

<!-- 👇 name为应用名称,url为应用地址 -->
<micro-app name='my-app' url='http://localhost:3000/'></micro-app>

子应用

在webpack-dev-server的headers中设置跨域支持。

devServer: {
  headers: {
    'Access-Control-Allow-Origin': '*',
  },
},

以上即完成微前端的嵌入,效果如下:

更多详细配置可以查看官网文档

🤝 参与共建

如果您对这个项目感兴趣,欢迎参与贡献,也欢迎 "Star" 支持一下 ^_^

本地运行

1、克隆项目

git clone https://github.com/micro-zoe/micro-app.git

2、安装依赖

yarn bootstrap

3、运行项目

yarn start # 访问 http://localhost:3000

更多命令请查看DEVELP

FAQ

问题汇总

具体细节请参考文章:micro-app介绍

对于不支持CustomElements的浏览器,可以通过引入polyfill进行兼容,详情可参考:webcomponents/polyfills

但是Proxy暂时没有做兼容,所以对于不支持Proxy的浏览器无法运行micro-app。

浏览器兼容性可以查看:Can I Use

总体如下:

  • PC端:除了IE浏览器,其它浏览器基本兼容。
  • 移动端:ios10+、android5+

如果是开发环境,可以在webpack-dev-server中设置headers支持跨域。

devServer: {
  headers: {
    'Access-Control-Allow-Origin': '*',
  },
}

如果是线上环境,可以通过配置nginx支持跨域。

支持,详情请查看适配vite

支持,详情请查看nextjsnuxtjs

贡献者们

License

MIT License