require-ensure
v1.0.2
Published
Proper require.ensure polyfill for node that is actually async.
Downloads
88
Maintainers
Readme
An isomorphic require.ensure polyfill that works in nodejs. This module is actually async and uses require-load to dynamically load files.
Works great with webpack codesplitting.
Installation
Npm
npm install require-ensure
Example
Setup require-ensure for node.
node -r require-ensure ./test.js
or
require('require-ensure')
require('./test')
Use require.ensure
require.ensure(['lodash', 'react'], function (require) {
const _ = require('lodash')
const React = require('react')
})
Contributions
- Use
npm test
to run tests.
Please feel free to create a PR!