# ciecc-remote-vue-comp

> An example of a micromodule based on the VUe-elements-admin transformation

Latest version **1.0.1** (published 2023-12-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install ciecc-remote-vue-comp
pnpm add ciecc-remote-vue-comp
yarn add ciecc-remote-vue-comp
bun add ciecc-remote-vue-comp
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2023-12-06 |
| First published | 2023-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8.9 |
| Dependencies | 13 |
| Unpacked size | 1.7 MB |
| Known vulnerabilities | 0 (+27 in 4 direct dependencies) |
| Install scripts | no |
| Author | hl |
| Maintainers | stone-2050 |

## Links

- npm: https://www.npmjs.com/package/ciecc-remote-vue-comp
- npm.io page: https://npm.io/package/ciecc-remote-vue-comp

## Dependencies (13)

- [vue](https://npm.io/package/vue.md) 2.6.10
- [vuex](https://npm.io/package/vuex.md) 3.1.0
- [axios](https://npm.io/package/axios.md) 0.18.1
- [core-js](https://npm.io/package/core-js.md) 3.6.5
- [cross-env](https://npm.io/package/cross-env.md) ^7.0.3
- [js-cookie](https://npm.io/package/js-cookie.md) 2.2.0
- [nprogress](https://npm.io/package/nprogress.md) 0.2.0
- [element-ui](https://npm.io/package/element-ui.md) ^2.15.14
- [vue-router](https://npm.io/package/vue-router.md) 3.0.6
- [hel-dev-utils](https://npm.io/package/hel-dev-utils.md) ^4.3.21
- [hel-lib-proxy](https://npm.io/package/hel-lib-proxy.md) ^4.8.5
- [normalize.css](https://npm.io/package/normalize.css.md) 7.0.0
- [path-to-regexp](https://npm.io/package/path-to-regexp.md) 2.4.0

## Recent versions

- 1.0.1 (latest) — 2023-12-06
- 1.0.0 — 2023-12-05

## README

# ciecc-remote-vue-comp

基于 [vue-admin-template](https://github.com/PanJiaChen/vue-admin-template) 改造为远程模块，详细改造说明见 HEL_DESC.md

# 改造说明（from HEL_DESC）

## 提供方改造

### 安装相关包
npm i hel-lib-proxy hel-dev-utils typescript@4.8 rollup@2 rollup-plugin-typescript rollup-plugin-terser shx

### 下沉入口文件
将原来的 `src/main.js` 内容复制到 `src/loadApp.js` 里

### 新增模块暴露目录
新增 `src/entrance` 目录作为统一暴露模块的出口目录

### 新增模块名描述文件
新增 `src/configs/subApp.js` 文件描述模块名

### 改造 `main.js`
引入 `hel-lib-proxy` 包，做分流控制
### 构建层引入模块描述文件
根目录引入 `subApp.js` 文件，对接 `hel-dev-utils`，供构建工具的`vue.config.js`文件使用，主要改动有
- `vue.config.js`里修改 publicPath、distDir、output.jsonpFunction、externals
- `public/index.html` 引入cdn vue
- `package.json` 启动命令里声明 PORT，对齐 publicPath 里的端口号
- 复制 https://github.com/hel-eco/hel-tpl-remote-vue-comp/tree/master/scripts 三个文件到 `scripts` 目录下
- `package.json` 新增命令 `build`用于构建hel包，可参考 https://github.com/hel-eco/hel-tpl-remote-vue-comp/blob/master/package.json 直接复制
- `package.json` 新增 `files` 表示npm发布要提交的文件范围

### 发布
npm run build
npm publish


## 使用方使用
入口文件先绑定vue运行时
```ts
import { bindVueRuntime } from 'hel-micro';
import Vue from 'vue';
bindVueRuntime({Vue});
```

### 懒加载
<Hamburger />

```ts
export default {
  components: {
    Hamburger: defineAsyncComponent(async () => {
      const comps = await preFetchLib("ciecc-remote-vue-comp");
      return comps.Hamburger;
    }),
  },
};
```

### 预加载
原入口文件下沉，然后加载远程模块，参考 https://github.com/hel-eco/hel-demo-use-remote-vue3-comp/blob/main/src/main.ts
```ts
await preFetchLib('ciecc-remote-vue-comp')
```

然后安装`ciecc-remote-vue-comp`, 其他地方可import 静态导入模块
```ts
import { Hamburger } from 'ciecc-remote-vue-comp';
```

---
_Source: https://npm.io/package/ciecc-remote-vue-comp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
