From 1a43bfc24395f868aa04a2b2ecae9a54713cc605 Mon Sep 17 00:00:00 2001 From: Stephen Hukish Date: Wed, 2 Jun 2021 18:24:26 -0400 Subject: [PATCH] WIP --- .../src/magic-entries-webpack-plugin.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/magic-entries-webpack-plugin/src/magic-entries-webpack-plugin.ts b/packages/magic-entries-webpack-plugin/src/magic-entries-webpack-plugin.ts index 3ec9e1a3ad..32912f3c48 100644 --- a/packages/magic-entries-webpack-plugin/src/magic-entries-webpack-plugin.ts +++ b/packages/magic-entries-webpack-plugin/src/magic-entries-webpack-plugin.ts @@ -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']; @@ -44,11 +45,13 @@ export class MagicEntriesPlugin { pattern = '*.entry.{jsx,js,ts,tsx}', folder = '.', nameFromFile = defaultNameFromFile, + onCompilerEntries = null, }: Partial = {}) { this.options = { folder, pattern, nameFromFile, + onCompilerEntries, }; this.compiledPattern = globToRegExp(pattern, {extended: true}); } @@ -63,7 +66,9 @@ export class MagicEntriesPlugin { ...(await defaultEntries), ...(await this.autodetectEntries(compiler)), }; - + if (this.options.onCompilerEntries) { + return this.options.onCompilerEntries(entries); + } return entries; }; }