Skip to content

Commit 111a124

Browse files
committed
[MV3] Boostrap from REQUIRED.js (created at build time by manifest.js).
1 parent e2f86c3 commit 111a124

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

manifest.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ const permissions = new Set(json.permissions);
3737

3838
if (MANIFEST_VER.includes(3)) {
3939
delete json.browser_specific_settings;
40+
const {scripts} = json.background;
41+
42+
if (scripts) {
43+
delete json.background.scripts;
44+
delete json.background.persistent;
45+
const requiredPath = path.join(path.dirname(MANIFEST_DEST), "REQUIRED.js");
46+
fs.writeFileSync(requiredPath,
47+
`include.REQUIRED = ${JSON.stringify(scripts, null, 2)};`)
48+
}
49+
4050
if (MANIFEST_VER.includes("edge")) {
4151
json.update_url = EDGE_UPDATE_URL;
4252
} else if (json.update_url === EDGE_UPDATE_URL) {
@@ -48,7 +58,7 @@ if (MANIFEST_VER.includes(3)) {
4858

4959
const excludedScriptsRx = /\bcontent\/(?:embeddingDocument|dirindex)\.js$/;
5060
for (const cs of json.content_scripts) {
51-
cs.js = cs.js.filter(path => !excludedScriptsRx.test(path));
61+
cs.js = cs.js.filter(src => !excludedScriptsRx.test(src));
5262
}
5363
delete json.browser_action;
5464
delete json.commands._execute_browser_action

src/nscl

0 commit comments

Comments
 (0)