Skip to content

Commit

Permalink
fix: restore html minimize options (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework committed Jul 12, 2024
1 parent 9ff8d83 commit 4570da3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/builder-rsbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"magic-string": "^0.30.5",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"rsbuild-plugin-html-minifier-terser": "^1.0.0",
"rsbuild-plugin-html-minifier-terser": "^1.1.0",
"style-loader": "^3.3.1",
"ts-dedent": "^2.2.0",
"url": "^0.11.0",
Expand Down
19 changes: 8 additions & 11 deletions packages/builder-rsbuild/src/preview/iframe-rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,14 @@ export default async (
},
plugins: [
shouldCheckTs ? pluginTypeCheck(tsCheckOptions) : null,
pluginHtmlMinifierTerser(),
pluginHtmlMinifierTerser({
collapseWhitespace: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: false,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true,
}),
].filter(Boolean),
tools: {
rspack: (config, { addRules, appendPlugins, rspack, mergeConfig }) => {
Expand Down Expand Up @@ -320,16 +327,6 @@ export default async (
headHtmlSnippet,
bodyHtmlSnippet,
},
// FIXME: rsbuild stop supporting html minimizing since https://github.com/web-infra-dev/rsbuild/commit/848a57c9e213c612a9b196899af10ec40907820f
// Track in https://github.com/rspack-contrib/rsbuild-plugin-html-minifier-terser/pull/1
// minify: {
// collapseWhitespace: true,
// removeComments: true,
// removeRedundantAttributes: true,
// removeScriptTypeAttributes: false,
// removeStyleLinkTypeAttributes: true,
// useShortDoctype: true,
// },
},
},
})
Expand Down
10 changes: 5 additions & 5 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 4570da3

Please sign in to comment.