FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Add require.context typings (#5156) · NativeScript/NativeScript@0986315 · GitHub

Commit 0986315

Browse files
feat: Add require.context typings (#5156)
Add WebpackRequire interface and append it with the require typing, this will let us use `require.context("~/", true, /page\.(xml|js|css)/g)`
1 parent d356339 commit 0986315

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎tns-core-modules/tns-core-modules.d.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ declare function fetch(url: string, init?: RequestInit): Promise<Response>;
2121
declare var console: Console;
2222
declare var require: NodeRequire;
2323

24+
// Extend NodeRequire with the webpack's require context extension.
25+
interface NodeRequire {
26+
context(root: string, recursive: boolean, filter: RegExp): {
27+
(module: string): any;
28+
id: number;
29+
keys(): string[];
30+
}
31+
}
32+
2433
declare var __dirname: string;
2534
declare var __filename: string;
2635

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL