Skip to content

Commit

Permalink
fix: Support the same entrypoint listed twice (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 authored Jul 8, 2023
1 parent 3bad9eb commit 5ad9ad6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,38 @@ describe("renderManifest", () => {

expect(actual).toEqual(expected);
});

it("should support rendering the same entrypoint twice", () => {
const input = {
name: "mv2-html-test",
version: "1.0.0",
browser_action: {
default_popup: "pages/popup.html",
},
sidebar_action: {
default_panel: "pages/popup.html",
},
};
const bundles: BundleMap = {
"pages/popup.html": [
"pages/popup.html",
"pages/popup.css",
"pages/popup.js",
],
};
const expected = {
name: "mv2-html-test",
version: "1.0.0",
browser_action: {
default_popup: "pages/popup.html",
},
sidebar_action: {
default_panel: "pages/popup.html",
},
};

const actual = renderManifest(input, bundles);

expect(actual).toEqual(expected);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ function findReplacement(entry: string, bundles: BundleMap) {
if (replacementIndex < 0)
throw Error(`Entrypoint output for ${entry} (${output}) not found`);

const [replacement] = generatedFiles.splice(replacementIndex, 1);
const [replacement] = generatedFiles.slice(
replacementIndex,
replacementIndex + 1
);
return {
replacement,
generatedFiles,
Expand Down

0 comments on commit 5ad9ad6

Please sign in to comment.