@rsbuild/core 0.4.10 → 0.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,7 +39,7 @@ const applyServerOptions = (command) => {
39
39
  command.option("-o --open [url]", "open the page in browser on startup").option("--port <port>", "specify a port number for server to listen").option("--host <host>", "specify the host that the server listens to");
40
40
  };
41
41
  function runCli() {
42
- import_commander.program.name("rsbuild").usage("<command> [options]").version("0.4.10");
42
+ import_commander.program.name("rsbuild").usage("<command> [options]").version("0.4.11");
43
43
  const devCommand = import_commander.program.command("dev");
44
44
  const buildCommand = import_commander.program.command("build");
45
45
  const previewCommand = import_commander.program.command("preview");
@@ -34,7 +34,7 @@ function prepareCli() {
34
34
  if (!npm_execpath || npm_execpath.includes("npx-cli.js")) {
35
35
  console.log();
36
36
  }
37
- import_rslog.logger.greet(` ${`Rsbuild v${"0.4.10"}`}
37
+ import_rslog.logger.greet(` ${`Rsbuild v${"0.4.11"}`}
38
38
  `);
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ var import_config = require("./config");
38
38
  var import_shared = require("@rsbuild/shared");
39
39
  var import_mergeConfig = require("./mergeConfig");
40
40
  var import_constants = require("./constants");
41
- const version = "0.4.10";
41
+ const version = "0.4.11";
42
42
  // Annotate the CommonJS export names for ESM import in node:
43
43
  0 && (module.exports = {
44
44
  PLUGIN_CSS_NAME,
@@ -187,7 +187,7 @@ const pluginHtml = () => ({
187
187
  if ((0, import_shared.isHtmlDisabled)(config, target)) {
188
188
  return;
189
189
  }
190
- const minify = await (0, import_shared.getMinify)(isProd, config);
190
+ const minify = await (0, import_shared.getHtmlMinifyOptions)(isProd, config);
191
191
  const assetPrefix = (0, import_shared.getPublicPathFromChain)(chain, false);
192
192
  const entries = chain.entryPoints.entries() || {};
193
193
  const entryNames = Object.keys(entries);
@@ -111,6 +111,7 @@ const getDefaultOutputConfig = () => ({
111
111
  legalComments: "linked",
112
112
  injectStyles: false,
113
113
  disableMinimize: false,
114
+ minify: true,
114
115
  sourceMap: {
115
116
  js: void 0,
116
117
  css: false
@@ -44,7 +44,7 @@ async function createContextByConfig(options, bundlerType, config = {}) {
44
44
  const context = {
45
45
  entry: (0, import_entry.getEntryObject)(config, "web"),
46
46
  targets: config.output?.targets || [],
47
- version: "0.4.10",
47
+ version: "0.4.11",
48
48
  rootPath,
49
49
  distPath,
50
50
  cachePath,
@@ -37,13 +37,19 @@ const pluginMinimize = () => ({
37
37
  setup(api) {
38
38
  api.modifyBundlerChain(async (chain, { isProd }) => {
39
39
  const config = api.getNormalizedConfig();
40
- const isMinimize = isProd && !config.output.disableMinimize;
40
+ const isMinimize = isProd && config.output.minify && !config.output.disableMinimize;
41
41
  chain.optimization.minimize(isMinimize);
42
42
  if (!isMinimize) {
43
43
  return;
44
44
  }
45
45
  const { SwcJsMinimizerRspackPlugin, SwcCssMinimizerRspackPlugin } = await Promise.resolve().then(() => __toESM(require("@rspack/core")));
46
- chain.optimization.minimizer(import_shared.CHAIN_ID.MINIMIZER.JS).use(SwcJsMinimizerRspackPlugin, [(0, import_shared.getSwcMinimizerOptions)(config)]).end().minimizer(import_shared.CHAIN_ID.MINIMIZER.CSS).use(SwcCssMinimizerRspackPlugin, []).end();
46
+ const { minifyJs, minifyCss } = (0, import_shared.parseMinifyOptions)(config);
47
+ if (minifyJs) {
48
+ chain.optimization.minimizer(import_shared.CHAIN_ID.MINIMIZER.JS).use(SwcJsMinimizerRspackPlugin, [(0, import_shared.getSwcMinimizerOptions)(config)]).end();
49
+ }
50
+ if (minifyCss) {
51
+ chain.optimization.minimizer(import_shared.CHAIN_ID.MINIMIZER.CSS).use(SwcCssMinimizerRspackPlugin, []).end();
52
+ }
47
53
  });
48
54
  }
49
55
  });
@@ -94,10 +94,15 @@ const pluginSwc = () => ({
94
94
  await applyCoreJs(swcConfig, chain, polyfillMode);
95
95
  }
96
96
  }
97
- rule.use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options(swcConfig);
97
+ const mergedSwcConfig = (0, import_shared.mergeChainedOptions)({
98
+ defaults: swcConfig,
99
+ options: config.tools.swc,
100
+ mergeFn: import_shared.deepmerge
101
+ });
102
+ rule.use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options(mergedSwcConfig);
98
103
  chain.module.rule(CHAIN_ID.RULE.JS_DATA_URI).mimetype({
99
104
  or: ["text/javascript", "application/javascript"]
100
- }).resolve.set("fullySpecified", false).end().use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options((0, import_shared.cloneDeep)(swcConfig));
105
+ }).resolve.set("fullySpecified", false).end().use(CHAIN_ID.USE.SWC).loader(builtinSwcLoaderName).options((0, import_shared.cloneDeep)(mergedSwcConfig));
101
106
  }
102
107
  });
103
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -52,12 +52,12 @@
52
52
  "types.d.ts"
53
53
  ],
54
54
  "dependencies": {
55
- "@rspack/core": "0.5.5",
55
+ "@rspack/core": "0.5.6",
56
56
  "@swc/helpers": "0.5.3",
57
57
  "core-js": "~3.32.2",
58
58
  "html-webpack-plugin": "npm:html-rspack-plugin@5.6.1",
59
59
  "postcss": "^8.4.33",
60
- "@rsbuild/shared": "0.4.10"
60
+ "@rsbuild/shared": "0.4.11"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/node": "16.x",