UNPKG

1.39 kBTypeScriptView Raw
1/**
2 * NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,
3 * you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.
4 */
5/**
6 * Checks whether we're in the Node.js or Browser environment
7 *
8 * @returns Answer to given question
9 */
10export declare function isNodeEnv(): boolean;
11/**
12 * Requires a module which is protected against bundler minification.
13 *
14 * @param request The module path to resolve
15 */
16export declare function dynamicRequire(mod: any, request: string): any;
17/**
18 * Helper for dynamically loading module that should work with linked dependencies.
19 * The problem is that we _should_ be using `require(require.resolve(moduleName, { paths: [cwd()] }))`
20 * However it's _not possible_ to do that with Webpack, as it has to know all the dependencies during
21 * build time. `require.resolve` is also not available in any other way, so we cannot create,
22 * a fake helper like we do with `dynamicRequire`.
23 *
24 * We always prefer to use local package, thus the value is not returned early from each `try/catch` block.
25 * That is to mimic the behavior of `require.resolve` exactly.
26 *
27 * @param moduleName module name to require
28 * @returns possibly required module
29 */
30export declare function loadModule<T>(moduleName: string): T | undefined;
31//# sourceMappingURL=node.d.ts.map
\No newline at end of file