# systemjs-intercept

> used to invade Systemjs and customize the behavior of obtaining dependencies

Latest version **1.0.14-doc.2** (published 2023-11-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install systemjs-intercept
pnpm add systemjs-intercept
yarn add systemjs-intercept
bun add systemjs-intercept
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.14-doc.2 |
| Published | 2023-11-21 |
| First published | 2023-08-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | zhanghongen |
| Keywords | systemjs |

## Links

- npm: https://www.npmjs.com/package/systemjs-intercept
- Homepage: https://github.com/zhangHongEn/universal-module-federation-plugin/tree/main/packages/systemjs-intercept
- Issues: https://github.com/zhangHongEn/universal-module-federation-plugin/issues
- npm.io page: https://npm.io/package/systemjs-intercept

## Dependencies (1)

- [systemjs](https://npm.io/package/systemjs.md) ^6.14.2

## Recent versions

- 1.0.14-doc.2 (latest) — 2023-11-21
- 1.0.14-doc.1 — 2023-11-21
- 1.0.14 — 2023-09-13
- 1.0.13 — 2023-09-13
- 1.0.12 — 2023-09-13
- 1.0.11 — 2023-09-13
- 1.0.10 — 2023-09-13
- 1.0.9 — 2023-09-11
- 1.0.8 — 2023-09-10
- 1.0.7 — 2023-08-25
- 1.0.6 — 2023-08-23
- 1.0.5 — 2023-08-18
- 1.0.4 — 2023-08-18
- 1.0.3 — 2023-08-18
- 1.0.2 — 2023-08-18
- … 2 more at https://npm.io/package/systemjs-intercept/versions

## README

``` js
require("systemjs-intercept")(function (dep) {
  // 能够拦截system的请求, 包含依赖
  // 比如请求npm cdn的react-dom模块, 其依赖"react"
  if (dep === "react") {
    return window.System.import("https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js")
    // 可以返回自定义值
    // return {
    //   test: "react"
    // }
  }
}, window.System)
console.log(111, window.System.import("https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js"))
```


``` js
const newSystem = new window.System.constructor()
require("systemjs-intercept")(function (dep) {
  // 能够拦截system的请求, 包含依赖
  // 比如请求npm cdn的react-dom模块, 其依赖"react"
  if (dep === "react") {
    return newSystem.import("https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.development.js")
    // 可以返回自定义值
    // return {
    //   test: "react"
    // }
  }
}, newSystem)
console.log(111, newSystem.import("https://cdn.jsdelivr.net/npm/react-dom@18.2.0/umd/react-dom.development.js"))
```

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