Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/ hel Public

A module federation SDK for browser and node, it is unrelated to tool chain for module consumer. 工具链无关的跨端模块联邦sdk.

License

Notifications You must be signed in to change notification settings

Tencent/hel

Repository files navigation

简体中文 | English

hel-logo

hel-micro, 原生跨端、工具链无关的模块联邦SDK ❤️

doc: https://helmicro.com or https://tencent.github.io/hel

特点

  • 原生跨端
    支撑在浏览器服务器双端同时使用

  • 双模驱动
    支持以传统包微模块包两种模式运行,通过编译参数做切换

  • 平台化
    可部署helpack做模块版本管理

  • 工程化
    提供hel命令行工具,完美适配pnpm大仓开发模式

  • 工具链无关
    前端微模块可对接webpackviteparcel等构建工具,后端微模块可运行于nodebundeno等运行时

快速开始

全局安装hel命令行工具

npm i create-hel -g

后端微模块

先映射欲提升为微模块的node模块,再启动你的服务

import { mapAndPreload } from 'hel-micro-node';
async function main() {
 // 如需使用 node_modules 模块,注释这里的调用即可
 await mapAndPreload({ '@hel-demo/mono-libs': true });
 await import('./server');
}

可通过以下命令行运行后端微模块示例项目

hel init demo1 -t node-demo
cd demo1
npm i
npm run start

前端微模块

先映射欲提升为微模块的前端模块,再载入你的前端应用

import { preFetchLib } from 'hel-micro';
async function start() {
 // 如需使用 node_modules 模块,注释这里的调用即可
 await preFetchLib('@hel-demo/mono-libs');
 await import('./loadApp');
}

webpack alias 配置模块映射关系

 alias: {
 // 如需使用 node_modules 模块,注释这里的映射即可
 '@hel-demo/mono-libs': '@hel-demo/mono-libs/hel' ,
 },

模块版本管理

可部署helpack做模块版本管理

hel init myhel -t helpack

helpack

开发与部署微模块

使用命令行工具初始化专用于开发与部署微模块的工程

hel init mymod
cd mymod
pnpm i
# 新建子模块
pnpm start .create-mod mylib
# 开发子模块
pnpm start mylib
# 构建子模块
pnpm start mylib build:nbsm
# 发布子模块
pnpm --filter mylib publish

更多说明见hel-mono文档

其他

访问旧版文档

🐚 谁在使用

欢迎在此issue里提供你的公司 logo,公司名,截图、站点等信息,提供给其他用户一些参考信息,让未来有更多的人参与到 hel-micro 的建设与使用中。

📦 了解更多

欢迎入群了解更多,由于微信讨论群号 200 人已满,需加作者微信号或 qq 群号,再邀请你如hel-micro讨论群(加号时记得备注 hel 哦)

image

👅License

hel-micro is released under the MIT License. http://www.opensource.org/licenses/mit-license

About

A module federation SDK for browser and node, it is unrelated to tool chain for module consumer. 工具链无关的跨端模块联邦sdk.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 8

AltStyle によって変換されたページ (->オリジナル) /