Skip to content

Commit

Permalink
perf(uni-builder): reuse rspack-manifest-plugin in webpack mode (#5675)
Browse files Browse the repository at this point in the history
  • Loading branch information
9aoy committed Apr 22, 2024
1 parent 58c3729 commit bf82b23
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 50 deletions.
7 changes: 7 additions & 0 deletions .changeset/beige-cameras-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@modern-js/uni-builder': patch
---

chore(uni-builder): reuse rspack-manifest-plugin in webpack mode

chore(uni-builder): 在 webpack 模式下复用 rspack-manifest-plugin
1 change: 0 additions & 1 deletion packages/cli/uni-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"terser-webpack-plugin": "5.3.10",
"ts-loader": "9.4.4",
"webpack": "^5.91.0",
"webpack-manifest-plugin": "5.0.0",
"webpack-subresource-integrity": "5.1.0"
},
"devDependencies": {
Expand Down
5 changes: 0 additions & 5 deletions packages/cli/uni-builder/src/rspack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export async function parseConfig(
options,
);

if (uniBuilderConfig.output?.enableAssetManifest) {
const { pluginManifest } = await import('./plugins/manifest');
rsbuildPlugins.push(pluginManifest());
}

if (uniBuilderConfig.tools?.babel) {
const { pluginBabel } = await import('@rsbuild/plugin-babel');
const { pluginBabelPost } = await import('./plugins/babel-post');
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/uni-builder/src/shared/parseCommonConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export async function parseCommonConfig(
svgDefaultExport,
assetsRetry,
enableAssetFallback,
enableAssetManifest,
disableSourceMap,
convertToRem,
disableMinimize,
Expand Down Expand Up @@ -456,6 +457,11 @@ export async function parseCommonConfig(
targets.includes('web') &&
rsbuildPlugins.push(pluginPostcssLegacy(overrideBrowserslist.web!));

if (enableAssetManifest) {
const { pluginManifest } = await import('./plugins/manifest');
rsbuildPlugins.push(pluginManifest());
}

return {
rsbuildConfig: mergeRsbuildConfig(rsbuildConfig, extraConfig),
rsbuildPlugins,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RsbuildPlugin } from '@rsbuild/core';
import { generateManifest } from '../../shared/manifest';
import { generateManifest } from '../manifest';

export const pluginManifest = (): RsbuildPlugin => ({
name: 'uni-builder:manifest',
Expand Down
5 changes: 0 additions & 5 deletions packages/cli/uni-builder/src/webpack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ export async function parseConfig(
);
}

if (uniBuilderConfig.output?.enableAssetManifest) {
const { pluginManifest } = await import('./plugins/manifest');
rsbuildPlugins.push(pluginManifest());
}

if (!uniBuilderConfig.output?.disableMinimize) {
const { pluginMinimize } = await import('./plugins/minimize');
rsbuildPlugins.push(pluginMinimize(uniBuilderConfig.tools?.terser));
Expand Down
24 changes: 0 additions & 24 deletions packages/cli/uni-builder/src/webpack/plugins/manifest.ts

This file was deleted.

14 changes: 0 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bf82b23

Please sign in to comment.