Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dahukish committed Jun 2, 2021
1 parent d3dd66e commit 1a43bfc
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface Options {
pattern: string;
folder: string | string[];
nameFromFile: (file: string) => string;
onCompilerEntries: ((entries: Entry) => Entry) | null;
}

type EntryOption = Compiler['options']['entry'];
Expand Down Expand Up @@ -44,11 +45,13 @@ export class MagicEntriesPlugin {
pattern = '*.entry.{jsx,js,ts,tsx}',
folder = '.',
nameFromFile = defaultNameFromFile,
onCompilerEntries = null,
}: Partial<Options> = {}) {
this.options = {
folder,
pattern,
nameFromFile,
onCompilerEntries,
};
this.compiledPattern = globToRegExp(pattern, {extended: true});
}
Expand All @@ -63,7 +66,9 @@ export class MagicEntriesPlugin {
...(await defaultEntries),
...(await this.autodetectEntries(compiler)),
};

if (this.options.onCompilerEntries) {
return this.options.onCompilerEntries(entries);
}
return entries;
};
}
Expand Down

0 comments on commit 1a43bfc

Please sign in to comment.