# require-ensure-shim

> node.js shim for webpack modules that use code splitting via "require.ensure()".

Latest version **1.0.4** (published 2015-09-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install require-ensure-shim
pnpm add require-ensure-shim
yarn add require-ensure-shim
bun add require-ensure-shim
```

## 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.4 |
| Published | 2015-09-24 |
| First published | 2015-09-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Hans-Peter Herzog @hpherzog |
| Maintainers | hpherzog |

## Links

- npm: https://www.npmjs.com/package/require-ensure-shim
- Repository: https://github.com/hpherzog/require-ensure-shim
- Homepage: https://github.com/hpherzog/require-ensure-shim#readme
- Issues: https://github.com/hpherzog/require-ensure-shim/issues
- npm.io page: https://npm.io/package/require-ensure-shim

## Recent versions

- 1.0.4 (latest) — 2015-09-24
- 1.0.3 — 2015-09-24
- 1.0.2 — 2015-09-24
- 1.0.0 — 2015-09-23

## README

Why this shim?
==============

If you use webpacks code splitting feature with shared javascript modules that you want to use server side with node.js, you need to shim this function to require your modules properly.

How to use
==========

Put the following code in every file you define a split point with require.ensure. It is important that you first shim and then define the split point.

```js
    require('require-ensure-shim').shim(require);

    require.ensure(['./module1'], function(require){

        var module1 = require('./module1');
        module1();
    });
```

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