DavidWeiss2 / safe-require

require that works if file exist.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

requirsafe

require.js hook that makes require works if file exist even if the file created at runtime.

Installation

In a browser:

<script src="requirsafe.js"></script>

Using npm:

$ npm i requirsafe

Note: add --save if you are using npm < 5.0.0

usage

In js: Load the hook before any other require.

require('requirsafe');
... existing code ...

Credits

@Zoltan Kochan, @Gilad Shoham and, @David First from @bit and to myself - @David Weiss

About

require that works if file exist.

License:MIT License


Languages

Language:JavaScript 100.0%