Skip to content

Commit e44c18b

Browse files
lucasrmendoncaLucas Mendoncavialoh
authored
Fix #479 Content Scripts not reloading bug (#480)
Before, when calling the plugin with the "manifest" option, the Content Scripts were not auto-reloading like they were when listing each entry as a separate argument. Now, using the "manifest" option also reloads the content scripts. Co-authored-by: Lucas Mendonca <[email protected]> Co-authored-by: vialoh <[email protected]>
1 parent a656c5f commit e44c18b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/utils/manifest.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { readFileSync } from 'fs';
2-
import { flatMapDeep } from 'lodash';
32
import * as JSON5 from 'json5';
43
import { Compiler, Entry } from 'webpack';
54
import { bgScriptEntryErrorMsg, bgScriptManifestRequiredMsg } from '../messages/errors';
@@ -63,11 +62,12 @@ export function extractEntries(
6362
}
6463

6564
const contentEntries = contentScripts
66-
? flatMapDeep(Object.keys(webpackEntry), (entryName) => {
67-
const entryFilename = getEntryFilename(entryName);
68-
69-
return contentScripts.map(({ js }) => js.filter((jsFilename) => jsFilename === entryFilename));
70-
})
65+
? Object.keys(webpackEntry).filter((entryName) =>
66+
contentScripts
67+
.flatMap(({ js }) => js)
68+
.filter(Boolean)
69+
.includes(getEntryFilename(entryName)),
70+
)
7171
: null;
7272

7373
return {

0 commit comments

Comments
 (0)