Skip to content

Commit 514391a

Browse files
felixmosheungyeole
authored andcommitted
refactor: use Object.fromEntries instead of reduce
1 parent ed2a445 commit 514391a

File tree

1 file changed

+7
-4
lines changed
  • packages/rsbuild-plugin-web-extension/src

1 file changed

+7
-4
lines changed

packages/rsbuild-plugin-web-extension/src/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { makeManifest } from "./manifest/make-manifest.js";
44
interface Options {
55
manifest: chrome.runtime.ManifestV3;
66
}
7+
78
export const pluginWebExtension = ({ manifest }: Options): RsbuildPlugin => ({
89
name: "rsbuild:plugin-web-extension",
910
setup: async (api) => {
@@ -19,10 +20,12 @@ export const pluginWebExtension = ({ manifest }: Options): RsbuildPlugin => ({
1920
* @issue https://github.com/web-infra-dev/rspack/issues/5971
2021
* @ref https://github.com/webdiscus/html-bundler-webpack-plugin
2122
*/
22-
const entry = htmlEntryPoints.reduce((acc, [name, entry]) => {
23-
acc[name] = entry?.replace(/\.html$/, ".tsx");
24-
return acc;
25-
}, {} as Record<string, string | undefined>);
23+
const entry = Object.fromEntries(
24+
htmlEntryPoints.map(([name, entry]) => [
25+
name,
26+
entry?.replace(/\.html$/, ".tsx"),
27+
])
28+
);
2629

2730
api.modifyRspackConfig((config, { mergeConfig, HtmlPlugin }) => {
2831
return mergeConfig(config, {

0 commit comments

Comments
 (0)