Skip to content

Commit 928d0ed

Browse files
committed
feat(): add includes and excludes options
1 parent 7e41d94 commit 928d0ed

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ import { randomBytes } from 'crypto';
66

77
export default function (opts: NodePolyfillsOptions = {}) {
88
const injectPlugin = inject({
9+
include: opts.include,
10+
exclude: opts.exclude,
11+
modules: {
912
'process': 'process',
1013
'Buffer': ['buffer', 'Buffer'],
1114
'global': GLOBAL_PATH,
1215
'__filename': FILENAME_PATH,
1316
'__dirname': DIRNAME_PATH,
17+
}
1418
});
1519
const basedir = opts.baseDir || '/';
1620
const dirs = new Map<string, string>();

src/modules.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export interface NodePolyfillsOptions {
44
fs?: boolean;
55
crypto?: boolean;
66
baseDir?: string;
7+
include?: Array<string | RegExp> | string | RegExp | null;
8+
exclude?: Array<string | RegExp> | string | RegExp | null;
79
}
810

911
export function builtinsResolver(opts: NodePolyfillsOptions) {

0 commit comments

Comments
 (0)