mirror of https://github.com/lukechilds/ow.git
Sam Verschueren
6 years ago
committed by
Sindre Sorhus
1 changed files with 13 additions and 4 deletions
@ -1,4 +1,13 @@ |
|||
// Export `__non_webpack_require__` in Webpack environments to make sure it doesn't bundle modules loaded via this method
|
|||
export default typeof (global as any).__non_webpack_require__ === 'function' |
|||
? (global as any).__non_webpack_require__ |
|||
: eval('require'); // tslint:disable-line:no-eval
|
|||
let customRequire: (packageName: string) => any; |
|||
|
|||
try { |
|||
// Export `__non_webpack_require__` in Webpack environments to make sure it doesn't bundle modules loaded via this method
|
|||
customRequire = (global as any).__non_webpack_require__ === 'function' |
|||
? (global as any).__non_webpack_require__ |
|||
: eval('require'); // tslint:disable-line:no-eval
|
|||
} catch { |
|||
// Use a noop in case both `__non_webpack_require__` and `require` does not exist
|
|||
customRequire = () => {}; // tslint:disable-line:no-empty
|
|||
} |
|||
|
|||
export default customRequire; |
|||
|
Loading…
Reference in new issue