<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Rspack Blog</title>
        <link>https://rspack.rs</link>
        <description>Rspack is a high performance JavaScript bundler written in Rust. It offers strong compatibility with the webpack ecosystem, and lightning fast build speeds.</description>
        <lastBuildDate>Tue, 07 Apr 2026 13:56:33 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <item>
            <title><![CDATA[Announcing Rspack 1.7]]></title>
            <link>https://rspack.rs/blog/announcing-1-7</link>
            <guid>/blog/announcing-1-7</guid>
            <pubDate>Wed, 31 Dec 2025 16:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>December 31, 2025</em></p>
<h1 id="announcing-rspack-17">Announcing Rspack 1.7<a aria-hidden="true" href="#announcing-rspack-17">#</a></h1>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-7.png" alt="Rspack 1.7"></img></p>
<hr></hr>
<p>We are excited to announce Rspack 1.7! This marks the final minor release in the Rspack 1.x series and focuses on stabilizing existing features. Next, we'll be moving toward Rspack 2.0.</p>
<p>Notable changes include:</p>
<ul>
<li>New features
<ul>
<li><a href="#improved-swc-plugin-compatibility">Improved SWC plugin compatibility</a></li>
<li><a href="#importing-assets-as-bytes">Importing assets as bytes</a></li>
<li><a href="#lazy-compilation">Lazy compilation</a></li>
<li><a href="#experimental-features-stabilized">Experimental features stabilized</a></li>
</ul>
</li>
<li>Rstack progress
<ul>
<li><a href="#rsbuild-17">Rsbuild 1.7</a></li>
<li><a href="#rsdoctor-14">Rsdoctor 1.4</a></li>
<li><a href="#rslib-019">Rslib 0.19</a></li>
<li><a href="#rstest-07">Rstest 0.7</a></li>
<li><a href="#rspress-20-rc">Rspress 2.0 RC</a></li>
</ul>
</li>
</ul>
<h2 id="new-features">New features<a aria-hidden="true" href="#new-features">#</a></h2>
<h3 id="improved-swc-plugin-compatibility">Improved SWC plugin compatibility<a aria-hidden="true" href="#improved-swc-plugin-compatibility">#</a></h3>
<p>In previous versions, the upgrade cost for SWC Wasm plugins was relatively high. This was because the SWC AST structure evolved across versions, causing existing plugins to fail after an SWC upgrade. Plugin authors needed to adapt their plugins, and users needed to upgrade their dependencies in lockstep, which affected project stability and the upgrade experience.</p>
<p>To address this issue, we contributed a series of <a href="https://swc.rs/docs/plugin/ecmascript/compatibility" target="_blank" rel="noopener noreferrer">compatibility improvements</a> to the SWC community, including:</p>
<ul>
<li>Using the self-describing <a href="https://www.rfc-editor.org/rfc/rfc8949.html" target="_blank" rel="noopener noreferrer">cbor</a> serialization scheme to replace the version-sensitive <a href="https://rkyv.org/" target="_blank" rel="noopener noreferrer">rkyv</a>, allowing Wasm plugins to better adapt to AST structure changes.</li>
<li>Introducing the <code>Unknown</code> variant for enum types in the AST, improving fault tolerance when encountering new fields or nodes.</li>
</ul>
<p>In Rspack 1.7, we upgraded the SWC version in use and adopted these compatibility improvements. From now on, in most scenarios, SWC upgrades are unlikely to break existing plugins built with older SWC versions.</p>
<p>Currently, this approach has been adopted by most popular SWC Wasm plugins. If you are an SWC Wasm plugin author, refer to the <a href="https://swc.rs/docs/plugin/ecmascript/compatibility#make-your-plugin-compatible" target="_blank" rel="noopener noreferrer">official guide</a> to adopt these changes and reduce maintenance costs in future version evolutions.</p>
<h3 id="importing-assets-as-bytes">Importing assets as bytes<a aria-hidden="true" href="#importing-assets-as-bytes">#</a></h3>
<p>Rspack now natively supports the <a href="https://github.com/tc39/proposal-import-bytes" target="_blank" rel="noopener noreferrer">Import Bytes</a> proposal for importing assets as bytes. You can now import assets as <code>Uint8Array</code> and decode them with <code>TextDecoder</code>.</p>
<pre><code>// Static  with { type: &#39;bytes&#39; };
const decoder = new TextDecoder(&#39;utf-8&#39;);
const text = decoder.decode(fileBytes);

// Dynamic import
const module = await import(&#39;./file.bin&#39;, { with: { type: &#39;bytes&#39; } });
const decoder = new TextDecoder(&#39;utf-8&#39;);
const text = decoder.decode(module.default);
</code></pre>
<h3 id="lazy-compilation">Lazy compilation<a aria-hidden="true" href="#lazy-compilation">#</a></h3>
<p>In Rspack 1.5, we stabilized the <a href="/guide/features/lazy-compilation">Lazy Compilation</a> feature and enabled it by default for dynamically imported modules in Rsbuild.</p>
<p>Starting from Rspack 1.7, the Rspack CLI also enables lazy compilation by default for dynamically imported modules when building web applications. This change reduces the number of modules in the initial build, thereby speeding up the dev server startup.</p>
<pre><code meta="">export default {
  // Current default configuration
  lazyCompilation: {
    imports: true,
    entries: false,
  },
};
</code></pre>
<p>If you have special requirements, such as needing to debug the full build output or inspect the complete module graph, you can explicitly disable this feature by setting <a href="/config/lazy-compilation">lazyCompilation</a> to <code>false</code>.</p>
<h3 id="experimental-features-stabilized">Experimental features stabilized<a aria-hidden="true" href="#experimental-features-stabilized">#</a></h3>
<p>In Rspack 1.7, we have stabilized several experimental features. The following capabilities have been verified in production and are now considered stable, and the corresponding experimental flags have been deprecated or enabled by default:</p>
<ul>
<li><strong>Constant Inlining Optimization</strong>: This optimization is now stable and enabled by default in production builds.
<ul>
<li>The original <a href="/config/deprecated-options#experimentsinlineconst">experiments.inlineConst</a> option is deprecated.</li>
<li>If you need to disable this behavior, use <a href="/config/optimization#optimizationinlineexports">optimization.inlineExports</a> to control it.</li>
</ul>
</li>
<li><strong>TypeScript Enum Inlining Optimization</strong>: This optimization is now stable.
<ul>
<li>The original <a href="/config/deprecated-options#experimentsinlineenum">experiments.inlineEnum</a> option is deprecated.</li>
<li>Use <a href="/guide/features/builtin-swc-loader#collecttypescriptinfoexportedenum">collectTypeScriptInfo.exportedEnum</a> to control whether to collect exported <code>enum</code> information.</li>
<li>Use <a href="/config/optimization#optimizationinlineexports">optimization.inlineExports</a> to control whether to inline <code>enum</code>.</li>
</ul>
</li>
<li><strong>Type Re-export Check</strong>: This optimization is now stable.
<ul>
<li>The original <a href="/config/deprecated-options#experimentstypereexportspresence">experiments.typeReexportsPresence</a> option is deprecated.</li>
</ul>
</li>
</ul>
<blockquote>
<p>Refer to the <a href="#upgrade-guide">Upgrade Guide</a> to learn how to adjust related configurations.</p>
</blockquote>
<h2 id="rstack-progress">Rstack progress<a aria-hidden="true" href="#rstack-progress">#</a></h2>
<h3 id="rsbuild-17">Rsbuild 1.7<a aria-hidden="true" href="#rsbuild-17">#</a></h3>
<h4 id="error-overlay-improvements">Error overlay improvements<a aria-hidden="true" href="#error-overlay-improvements">#</a></h4>
<p>Rsbuild's error overlay now supports displaying <strong>runtime errors</strong>. When an exception is thrown during application execution, the error will be rendered directly on the overlay, helping you identify and diagnose issues faster.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-7-rsbuild-error-overlay.png" alt="Rsbuild 1.7 Error Overlay"></img></p>
<p>This feature is disabled by default and can be enabled via the <a href="https://rsbuild.rs/config/dev/client#overlayruntime" target="_blank" rel="noopener noreferrer">dev.client.overlay.runtime</a> option:</p>
<pre><code meta="">export default {
  dev: {
    client: {
      overlay: {
        runtime: true,
      },
    },
  },
};
</code></pre>
<h4 id="asset-size-diff-reporting">Asset size diff reporting<a aria-hidden="true" href="#asset-size-diff-reporting">#</a></h4>
<p>Rsbuild now supports reporting size differences to see whether the build output size has changed.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-7-rsbuild-print-size-diff.png" alt="Rsbuild 1.7 Print Size Diff"></img></p>
<p>When the <a href="https://rsbuild.rs/config/performance/print-file-size#diff" target="_blank" rel="noopener noreferrer">performance.printFileSize.diff</a> option is enabled, Rsbuild records a snapshot of the asset sizes upon build completion. Subsequent builds will automatically compare with the previous result and display size deltas in the logs. You can clearly see whether each file has grown or shrunk, as well as the overall size change, making it suitable for quickly spotting size regressions during daily development.</p>
<pre><code meta="">export default {
  performance: {
    printFileSize: {
      diff: true,
    },
  },
};
</code></pre>
<h4 id="create-rsbuild-improvements">create-rsbuild improvements<a aria-hidden="true" href="#create-rsbuild-improvements">#</a></h4>
<p><code>create-rsbuild</code> now includes more out-of-the-box tools.</p>
<p>When creating an Rsbuild project, you can now choose to automatically integrate <a href="https://rstest.rs/" target="_blank" rel="noopener noreferrer">Rstest</a> as the testing framework or enable <a href="https://storybook.rsbuild.rs/" target="_blank" rel="noopener noreferrer">Storybook</a> for UI component development and debugging. Related dependencies and configurations will be set up during initialization, reducing repetitive manual configuration costs.</p>
<pre><code>◆  Select additional tools (Use &lt;space&gt; to select, &lt;enter&gt; to continue)
│  ◼ Rstest - testing
│  ◻ Biome - linting &amp; formatting
│  ◻ ESLint - linting
│  ◻ Prettier - formatting
│  ◻ Storybook - component development
└
</code></pre>
<h3 id="rsdoctor-14">Rsdoctor 1.4<a aria-hidden="true" href="#rsdoctor-14">#</a></h3>
<h4 id="new-treemap-view">New treemap view<a aria-hidden="true" href="#new-treemap-view">#</a></h4>
<p>Rsdoctor 1.4 introduces an improved <a href="https://rsdoctor.rs/guide/usage/bundle-size" target="_blank" rel="noopener noreferrer">Treemap</a> view. The new interaction design helps you analyze the overall composition of the bundle and the size proportion of various assets and modules more intuitively.</p>
<p>In this view, you can quickly locate specific modules or assets via search. Clicking on a module or asset will automatically focus and zoom in on the corresponding area. Double-clicking a module can also expand its dependency chain, allowing you to view the reference relationship between modules layer by layer, helping identify where the size comes from.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-7-rsdoctor-treemap.gif" alt="Rsdoctor Treemap"></img></p>
<h3 id="rslib-019">Rslib 0.19<a aria-hidden="true" href="#rslib-019">#</a></h3>
<h4 id="esm-output-stabilization">ESM output stabilization<a aria-hidden="true" href="#esm-output-stabilization">#</a></h4>
<p>In previous versions, Rslib enabled Rspack's <a href="/plugins/rspack/esm-library-plugin#esmlibraryplugin">new ESM library output</a> through the experimental configuration <a href="https://rslib.rs/config/lib/experiments#experimentsadvancedesm" target="_blank" rel="noopener noreferrer">experiments.advancedEsm</a> to improve the quality of ESM output. After verification and polishing over multiple versions, this capability is now stable.</p>
<p>Starting from Rslib 0.19, Rslib's bundle mode enables this feature by default. Developers do not need any additional configuration to directly obtain ESM artifacts that are friendly to static analysis and fully support code splitting.</p>
<h4 id="javascript-api">JavaScript API<a aria-hidden="true" href="#javascript-api">#</a></h4>
<p>Rslib 0.19 introduces a <a href="https://rslib.rs/api/start" target="_blank" rel="noopener noreferrer">JavaScript API</a>, allowing developers to invoke Rslib's build capabilities programmatically in JavaScript code.</p>
<p>Here is a basic example:</p>
<pre><code>

// Create Rslib instance
const rslib = await createRslib();
// Build production output
await rslib.build();
</code></pre>
<blockquote>
<p>For more usage, refer to the <a href="https://rslib.rs/api/javascript-api/core" target="_blank" rel="noopener noreferrer">API Documentation</a>.</p>
</blockquote>
<h3 id="rstest-07">Rstest 0.7<a aria-hidden="true" href="#rstest-07">#</a></h3>
<h4 id="configuration-adapters">Configuration adapters<a aria-hidden="true" href="#configuration-adapters">#</a></h4>
<p>Rstest 0.7 introduces the <a href="https://rstest.rs/config/test/extends" target="_blank" rel="noopener noreferrer">extends</a> option and an adapter mechanism, allowing you to directly reuse existing tool or framework configurations. An adapter is a configuration transformation function that can convert configurations from other tools into Rstest configurations, thereby reducing the integration overhead of Rstest.</p>
<p>For example, in a library project using Rslib, you can directly reuse the existing Rslib configuration via the <a href="https://www.npmjs.com/package/@rstest/adapter-rslib" target="_blank" rel="noopener noreferrer">@rstest/adapter-rslib</a> adapter:</p>
<pre><code meta="">


export default defineConfig({
  // Automatically read rslib.config.ts and convert to Rstest configuration
  extends: withRslibConfig(),
  // Other test configurations
  coverage: {
    // ...
  },
});
</code></pre>
<p>The adapter is responsible for converting configurations of different tools into Rstest configurations (such as <code>define</code>, <code>alias</code>, etc.), while <code>extends</code> is responsible for merging the converted configuration with Rstest's configuration. By combining the two, any tool or framework based on Rspack can be integrated with Rstest at minimal cost.</p>
<p>Currently, the <code>@rstest/adapter-rslib</code> adapter has been officially released, and we will launch more adapters to interface with various tools in the Rstack. You can also refer to <a href="https://rstest.rs/guide/integration/adapters" target="_blank" rel="noopener noreferrer">Rstest - Adapters</a> to write custom adapters.</p>
<h4 id="improved-test-feedback">Improved test feedback<a aria-hidden="true" href="#improved-test-feedback">#</a></h4>
<p>Rstest has made several usability improvements for local development and debugging scenarios, making test feedback more intuitive:</p>
<ul>
<li>
<p><strong>Spot stuck tests earlier:</strong> Rstest now supports marking test cases that have not completed for a long time during local runs. When the test process slows down, you can directly see which case is executing and may be stuck, instead of waiting blindly for the test to time out.</p>
</li>
<li>
<p><strong>Clearer timeout failure feedback:</strong> When a test fails due to timeout, Rstest now displays the number of executed assertions in the error message. This helps you quickly judge whether the test has been partially executed or is stuck in some asynchronous logic, thus locating the problem faster.</p>
</li>
</ul>
<h3 id="rspress-20-rc">Rspress 2.0 RC<a aria-hidden="true" href="#rspress-20-rc">#</a></h3>
<h4 id="ssg-md-feature">SSG-MD feature<a aria-hidden="true" href="#ssg-md-feature">#</a></h4>
<p>In front-end frameworks that rely on dynamic React rendering, static information is often difficult to extract, and Rspress also encountered the same problem. Rspress allows users to enhance document expressiveness through dynamic features such as <a href="https://v2.rspress.rs/guide/use-mdx/components" target="_blank" rel="noopener noreferrer">MDX fragments</a>, React components, Hooks, and TSX routes. However, these dynamic contents face several challenges when converted to Markdown text:</p>
<ul>
<li>Directly inputting MDX to AI will contain a lot of code syntax noise and lose React component content.</li>
<li>Converting SSG-generated HTML to Markdown often yields poor results, and information quality is difficult to guarantee.</li>
</ul>
<p>To solve this problem, Rspress 2.0 introduces the <a href="https://v2.rspress.rs/guide/basic/ssg-md" target="_blank" rel="noopener noreferrer">SSG-MD</a> feature. This is a new rendering mode, as the name suggests, the key difference from traditional <a href="https://v2.rspress.rs/guide/basic/ssg" target="_blank" rel="noopener noreferrer">Static Site Generation (SSG)</a> is that it renders your page into Markdown files instead of HTML files, and generates <a href="https://llmstxt.org/" target="_blank" rel="noopener noreferrer">llms.txt</a> and llms-full.txt files. Compared to traditional approaches such as converting HTML to Markdown, SSG-MD has better information sources during rendering, such as React Virtual DOM, so it produces higher-quality static content with greater flexibility.</p>
<p>Enabling it is very simple:</p>
<pre><code meta="">

export default defineConfig({
  llms: true,
});
</code></pre>
<p>The build will generate the following structure:</p>
<pre><code>doc_build
├── llms.txt          # Summary version, containing key document index
├── llms-full.txt     # Full version, containing all document content
├── guide
│   └── start
│       └── introduction.md
└── ...
</code></pre>
<p>For custom components, you can control their rendering behavior in SSG-MD mode via environment variables:</p>
<pre><code>export function Tab({ label }: { label: string }) {
  if (import.meta.env.SSG_MD) {
    // Output plain text description in SSG-MD mode
    return &lt;&gt;{`**Tab: ${label}**`}&lt;/&gt;;
  }
  // Normal interactive component rendering
  return &lt;div className=&quot;tab&quot;&gt;{label}&lt;/div&gt;;
}
</code></pre>
<p>This preserves the interactive experience of the document and helps AI understand the semantic information of the components.</p>
<blockquote>
<p>For more details, refer to: <a href="https://v2.rspress.rs/guide/basic/ssg-md" target="_blank" rel="noopener noreferrer">SSG-MD Guide</a></p>
</blockquote>
<h2 id="upgrade-guide">Upgrade guide<a aria-hidden="true" href="#upgrade-guide">#</a></h2>
<h3 id="upgrade-swc-plugins">Upgrade SWC plugins<a aria-hidden="true" href="#upgrade-swc-plugins">#</a></h3>
<p>If your project uses SWC Wasm plugins (such as <code>@swc/plugin-emotion</code>, etc.), upgrade the plugins to be compatible with <code>swc_core@54</code> or above, otherwise build failures or runtime exceptions may occur due to version incompatibility.</p>
<blockquote>
<p>For details, see <a href="/errors/swc-plugin-version">FAQ - SWC plugin version mismatch</a>.</p>
</blockquote>
<h3 id="remove-deprecated-configuration">Remove deprecated configuration<a aria-hidden="true" href="#remove-deprecated-configuration">#</a></h3>
<ul>
<li>The following experimental options have been deprecated and can be directly removed:</li>
</ul>
<pre><code meta="">export default {
  // [!code --]
  experiments: {
    // [!code --]
    inlineConst: true,
    // [!code --]
    inlineEnum: true,
    // [!code --]
    typeReexportsPresence: true,
  },
};
</code></pre>
<ul>
<li>Adjust the position of the <a href="/guide/features/builtin-swc-loader#collecttypescriptinfo">collectTypeScriptInfo</a> option in <code>builtin:swc-loader</code>, removing the <code>rspackExperiments</code> level:</li>
</ul>
<pre><code meta="">export default {
  module: {
    rules: [
      {
        test: /\.ts$/,
        loader: 'builtin:swc-loader',
        options: {
          // [!code --]
          rspackExperiments: {
            collectTypeScriptInfo: {
              exportedEnum: true,
              typeExports: true,
            },
            // [!code --]
          },
        },
      },
    ],
  },
};
</code></pre>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.6]]></title>
            <link>https://rspack.rs/blog/announcing-1-6</link>
            <guid>/blog/announcing-1-6</guid>
            <pubDate>Thu, 30 Oct 2025 16:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>October 30, 2025</em></p>
<h1 id="announcing-rspack-16">Announcing Rspack 1.6<a aria-hidden="true" href="#announcing-rspack-16">#</a></h1>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-6.png" alt="Rspack 1.6"></img></p>
<hr></hr>
<p>We are excited to announce Rspack 1.6!</p>
<p>Notable changes include:</p>
<ul>
<li>New Features
<ul>
<li><a href="#enhanced-tree-shaking">Enhanced tree shaking</a></li>
<li><a href="#support-for-import-defer">Support for import defer</a></li>
<li><a href="#improved-esm-output">Improved ESM output</a></li>
<li><a href="#optimized-barrels-by-default">Optimized barrels by default</a></li>
<li><a href="#stabilized-layers-feature">Stabilized layers feature</a></li>
<li><a href="#preserve-jsx-syntax">Preserve JSX syntax</a></li>
<li><a href="#extract-source-map">Extract source map</a></li>
<li><a href="#performance-improvements">Performance improvements</a></li>
</ul>
</li>
<li>Rstack Progress
<ul>
<li><a href="#rsbuild-1-6">Rsbuild 1.6</a></li>
<li><a href="#rspress-v2-beta">Rspress v2 beta</a></li>
<li><a href="#rslib-0-16">Rslib 0.16</a></li>
<li><a href="#rstest-0-6">Rstest 0.6</a></li>
<li><a href="#rsdoctor-1-3">Rsdoctor 1.3</a></li>
</ul>
</li>
<li>Ecosystem
<ul>
<li><a href="#next-rspack">next-rspack</a></li>
</ul>
</li>
</ul>
<h2 id="new-features">New features<a aria-hidden="true" href="#new-features">#</a></h2>
<h3 id="enhanced-tree-shaking">Enhanced tree shaking<a aria-hidden="true" href="#enhanced-tree-shaking">#</a></h3>
<p>Rspack 1.6 improved tree shaking support for dynamic imports. In previous versions, Rspack could only perform tree shaking on destructured assignments within dynamic imports, while other import patterns were not analyzed.</p>
<p>Now, Rspack introduces comprehensive static analysis for dynamic imports. It can recognize and handle a wider range of usage patterns. This allows Rspack to precisely eliminate unused exports and further reduce the size of the final bundle.</p>
<pre><code>// Rspack 1.5 – Only supported destructured imports
const { value } = await import(&#39;./module&#39;);
console.log(value);

// Rspack 1.6 – Now supports the following cases
// Case 1
const mod = await import(&#39;./module&#39;);
const { value } = mod;
console.log(value);

// Case 2
const mod = await import(&#39;./module&#39;);
console.log(mod.value);

// Case 3
import(&#39;./module&#39;).then(({ value }) =&gt; {
  console.log(value);
});

// Case 4
import(&#39;./module&#39;).then((mod) =&gt; {
  const { value } = mod;
  console.log(value);
});

// Case 5
import(&#39;./module&#39;).then((mod) =&gt; {
  console.log(mod.value);
});
</code></pre>
<h3 id="support-for-import-defer">Support for import defer<a aria-hidden="true" href="#support-for-import-defer">#</a></h3>
<p>Rspack now supports the <a href="https://github.com/tc39/proposal-defer-import-eval" target="_blank" rel="noopener noreferrer">import defer</a> syntax.</p>
<p><code>import defer</code> is a new feature in JavaScript, which is also supported in <a href="https://devblogs.microsoft.com/typescript/announcing-typescript-5-9-beta/#support-for-import-defer" target="_blank" rel="noopener noreferrer">TypeScript 5.9</a>. It allows you to import a module without immediately executing the module and its dependencies, giving you better control over when code execution and side effects occur.</p>
<pre><code>
</code></pre>
<p>You can enable this feature through <a href="/config/experiments#experimentsdeferimport">experiments.deferImport</a>:</p>
<pre><code meta="">export default {
  experiments: {
    deferImport: true,
  },
};
</code></pre>
<blockquote>
<p>Currently, Rspack only supports the <code>import defer</code> syntax. The function form <code>import.defer()</code> will be implemented in future versions.</p>
</blockquote>
<h3 id="improved-esm-output">Improved ESM output<a aria-hidden="true" href="#improved-esm-output">#</a></h3>
<p>Optimizing ESM output has long been one of the key challenges faced by Rspack. Previously, we relied on <a href="/config/optimization#optimizationconcatenatemodules">module concatenation</a> to optimize ESM outputs, but that approach had several limitations:</p>
<ul>
<li><strong>Impure output</strong> – The generated files contained Rspack's runtime code.</li>
<li><strong>Prone to errors</strong> – Some modules could not be correctly concatenated, leading to unexpected runtime issues.</li>
<li><strong>Limited code-splitting support</strong> – Split bundles became complex and difficult to analyze or optimize statically.</li>
</ul>
<p>To address these issues once and for all, we introduced an experimental plugin called <a href="/plugins/rspack/esm-library-plugin">EsmLibraryPlugin</a>, purpose-built for constructing clean and efficient ESM libraries:</p>
<ul>
<li><strong>Full control over the bundling process</strong> – All modules are linked during compilation, eliminating reliance on Rspack's runtime.</li>
<li><strong>Code-splitting support</strong> – Code after splitting can be statically analyzed and is tree-shaking friendly.</li>
</ul>
<p>The image below compares the code splitting output before and after using this plugin — the left side shows the previous output, while the right side shows the cleaner output produced by EsmLibraryPlugin:</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-6-esm-diff.png" alt="Rspack 1.6 ESM output diff"></img></p>
<p>The EsmLibraryPlugin is now largely complete and is being integrated into Rslib to provide an out-of-the-box experience. You can also enable it manually with the following configuration:</p>
<pre><code meta="">

export default {
  plugins: [new rspack.experiments.EsmLibraryPlugin()],
  optimization: {
    // Recommended to enable; otherwise, consumers must import runtime code from the entry.
    runtimeChunk: true,
  },
};
</code></pre>
<p>In addition, we've introduced an <code>preserveModules</code> option that preserves the original directory structure of your source files in the output:</p>
<pre><code meta="">

export default {
  plugins: [
    new rspack.experiments.EsmLibraryPlugin({
      preserveModules: path.resolve(import.meta.dirname, './src'),
    }),
  ],
};
</code></pre>
<h3 id="optimized-barrels-by-default">Optimized barrels by default<a aria-hidden="true" href="#optimized-barrels-by-default">#</a></h3>
<p>In Rspack 1.5, we introduced the experimental <a href="/config/experiments#experimentslazybarrel">lazyBarrel</a> optimization feature, specifically designed to improve the build performance of barrel files. After a period of production environment practice and user feedback collection, we confirmed that the lazyBarrel feature has reached a stable state, so it is enabled by default in Rspack 1.6.</p>
<div><div>INFO</div><div><p>What are barrel files? Barrel files are files that are primarily used to re-export content from other modules, typically used to simplify import paths and provide a unified API entry point.</p></div></div>
<h3 id="stabilized-layers-feature">Stabilized layers feature<a aria-hidden="true" href="#stabilized-layers-feature">#</a></h3>
<p>Layer is a feature for organizing modules into different layers, which can be useful in advanced scenarios such as React Server Components. By assigning different layers to modules, you can gain finer control over their build behavior, for example:</p>
<ul>
<li>Compiling modules in different layers for different target environments</li>
<li>Outputting them to separate build directories</li>
</ul>
<p>Starting from Rspack 1.6, the layer feature has become stable enough that the experimental flag <a href="/config/experiments#experimentslayers">experiments.layers</a> has been deprecated. You can now use the layer feature directly without the experimental flag.</p>
<p>For more details and practical examples, check out our new <a href="/guide/features/layer#layer">Layer guide</a>.</p>
<h3 id="preserve-jsx-syntax">Preserve JSX syntax<a aria-hidden="true" href="#preserve-jsx-syntax">#</a></h3>
<p>Rspack now supports preserving JSX syntax in the build output. When this option is enabled, Rspack only parses JSX syntax without transforming it into JavaScript.</p>
<p>This feature is especially useful when building libraries that rely on JSX. For example, when using Rslib to build a component library, you can choose to keep the JSX code as-is in the output, allowing the consumer to handle the final JSX transformation during usage.</p>
<pre><code meta="">export default {
  module: {
    parser: {
      javascript: {
        jsx: true, // Enable JSX parsing
      },
    },
    rules: [
      {
        test: /\.jsx?$/,
        use: {
          loader: 'builtin:swc-loader',
          options: {
            jsc: {
              parser: { jsx: true },
              transform: {
                // Preserve JSX syntax
                react: { runtime: 'preserve' },
              },
            },
          },
        },
      },
    ],
  },
};
</code></pre>
<h3 id="extract-source-map">Extract source map<a aria-hidden="true" href="#extract-source-map">#</a></h3>
<p>Rspack now supports extracting existing source map data from files (from their <code>//# sourceMappingURL</code> comments) through <a href="/config/module-rules#rulesextractsourcemap">rules[].extractSourceMap</a>. This feature is particularly useful for preserving source maps provided by third-party libraries, ensuring that debugging information remains accurate even when these libraries are bundled or transformed.</p>
<p>This feature was introduced as a built-in alternative to <a href="https://github.com/webpack-contrib/source-map-loader" target="_blank" rel="noopener noreferrer">source-map-loader</a>, providing better performance and tighter integration with the build process.</p>
<pre><code meta="">export default {
  module: {
    rules: [
      {
        test: /\.m?js$/,
        extractSourceMap: true,
      },
    ],
  },
};
</code></pre>
<h3 id="performance-improvements">Performance improvements<a aria-hidden="true" href="#performance-improvements">#</a></h3>
<p>Rspack 1.6 introduces several performance optimizations. Compared with Rspack 1.5.0, you can expect the following improvements:</p>
<ul>
<li>CLI startup is about <strong>50 ms faster</strong></li>
<li>Building 10000 React components is <strong>11% faster</strong></li>
<li>Building multiple UI component libraries is <strong>31% faster</strong> (thanks to the newly enabled barrel-file optimization by default)</li>
</ul>
<blockquote>
<p>Data source: <a href="https://github.com/rstackjs/build-tools-performance" target="_blank" rel="noopener noreferrer">Rspack benchmark</a></p>
</blockquote>
<h2 id="rstack-progress">Rstack progress<a aria-hidden="true" href="#rstack-progress">#</a></h2>
<p><a href="/guide/start/ecosystem#rstack">Rstack</a> is a unified JavaScript toolchain centered around Rspack, featuring excellent performance and consistent architecture.</p>
<h3 id="rsbuild-16">Rsbuild 1.6<a aria-hidden="true" href="#rsbuild-16">#</a></h3>
<h4 id="forward-browser-logs">Forward browser logs<a aria-hidden="true" href="#forward-browser-logs">#</a></h4>
<p>Rsbuild now automatically forwards error logs from the browser to the terminal, helping you conveniently view runtime errors during development. This also enables Coding Agents to obtain more complete context from terminal logs, allowing them to better analyze and locate errors.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-6-error-forward.png" alt="rsbuild-error-forward"></img></p>
<p>If you don't need this feature, you can disable it by setting <a href="https://rsbuild.rs/config/dev/browser-logs" target="_blank" rel="noopener noreferrer">dev.browserLogs</a> to false:</p>
<pre><code meta="">export default {
  dev: {
    browserLogs: false,
  },
};
</code></pre>
<h4 id="building-esm-applications">Building ESM applications<a aria-hidden="true" href="#building-esm-applications">#</a></h4>
<p>Rsbuild now supports building ES Modules format output for Web applications, simply enable <a href="https://rsbuild.rs/config/output/module" target="_blank" rel="noopener noreferrer">output.module: true</a>:</p>
<pre><code meta="">export default {
  output: {
    module: true,
  },
};
</code></pre>
<p>Once enabled, Rsbuild will no longer generate IIFE format scripts by default, but will output standard ESM format and automatically set the generated <code>&lt;script&gt;</code> tags to <code>type=&quot;module&quot;</code>.</p>
<h4 id="faster-configuration-loading">Faster configuration loading<a aria-hidden="true" href="#faster-configuration-loading">#</a></h4>
<p>Since Node.js 22 already natively supports TypeScript, Rsbuild now defaults to using Node.js's native loader to parse configuration files; if loading fails, it will automatically fall back to <a href="https://github.com/unjs/jiti" target="_blank" rel="noopener noreferrer">Jiti</a>. When using Node.js 22 and above, this mechanism ensures that module resolution behavior remains consistent with Node.js native behavior while providing better loading performance.</p>
<p>You can also manually specify the loading method through the Rsbuild CLI's --config-loader option:</p>
<pre><code># Force use of native loading
rsbuild build --config-loader native

# Force use of jiti loading
rsbuild build --config-loader jiti
</code></pre>
<h3 id="rspress-v2-beta">Rspress v2 beta<a aria-hidden="true" href="#rspress-v2-beta">#</a></h3>
<h4 id="new-theme-preview">New theme preview<a aria-hidden="true" href="#new-theme-preview">#</a></h4>
<p>Rspress's new theme has entered preview phase and is now live on the v2 website. 🎉</p>
<p>The new theme has been comprehensively upgraded in design, bringing a better documentation reading experience. It also exposes more theme APIs and CSS class names, making it easier for developers to customize the UI.</p>
<blockquote>
<p>👉 Visit the <a href="https://v2.rspress.rs/" target="_blank" rel="noopener noreferrer">Rspress v2 website</a> to try it out.</p>
</blockquote>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-6-rspress.gif" alt="rspress-v2-theme"></img></p>
<h4 id="sub-page-switching">Sub-page switching<a aria-hidden="true" href="#sub-page-switching">#</a></h4>
<p>Rspress v2 introduces the <a href="https://v2.rspress.rs/ui/components/page-tabs" target="_blank" rel="noopener noreferrer">PageTabs</a> component, allowing you to create multiple sub-tabs within a single page. This helps naturally split long content into well-structured subpages.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-6-page-tabs.png" alt="Rspress sub-page switching"></img></p>
<h3 id="rslib-016">Rslib 0.16<a aria-hidden="true" href="#rslib-016">#</a></h3>
<h4 id="faster-type-generation">Faster type generation<a aria-hidden="true" href="#faster-type-generation">#</a></h4>
<p>Rslib now supports generating type declaration files based on <a href="https://github.com/microsoft/typescript-go" target="_blank" rel="noopener noreferrer">typescript-go</a>. By simply enabling <a href="https://rslib.rs/config/lib/dts#dtstsgo" target="_blank" rel="noopener noreferrer">dts.tsgo</a>, you can boost type checking and declaration generation performance by around <strong>300%</strong>, with even greater benefits in large projects.</p>
<pre><code meta="">export default {
  lib: [
    {
      dts: { tsgo: true },
    },
  ],
};
</code></pre>
<h4 id="preserve-jsx-syntax-1">Preserve JSX syntax<a aria-hidden="true" href="#preserve-jsx-syntax-1">#</a></h4>
<p>Rslib now supports preserving original JSX in build output, simply set runtime to <a href="https://rsbuild.rs/plugins/list/plugin-react#preserve" target="_blank" rel="noopener noreferrer"><code>&#39;preserve&#39;</code></a>. In this mode, JSX syntax will be preserved as-is without any transformation, making it convenient for subsequent processing by other bundling tools.</p>
<pre><code meta="">

export default {
  lib: [
    {
      bundle: false,
      format: 'esm',
    },
  ],
  plugins: [
    pluginReact({
      swcReactOptions: {
        runtime: 'preserve',
      },
    }),
  ],
};
</code></pre>
<h4 id="more-cli-options">More CLI options<a aria-hidden="true" href="#more-cli-options">#</a></h4>
<p>Rslib supports additional <a href="https://rslib.rs/guide/basic/cli#rslib-build" target="_blank" rel="noopener noreferrer">CLI options</a> in the build command, which take precedence over configuration files.</p>
<pre><code meta="">{
  "scripts": {
    "build": "rslib build --entry index.ts --minify --tsconfig tsconfig.build.json"
  }
}
</code></pre>
<p>This also allows you to use Rslib without a configuration file, and the CLI will automatically use a default configuration containing only a single <a href="https://rslib.rs/config/lib/" target="_blank" rel="noopener noreferrer">lib</a> and complete the build based on command line parameters.</p>
<h3 id="rstest-06">Rstest 0.6<a aria-hidden="true" href="#rstest-06">#</a></h3>
<h4 id="vs-code-extension">VS Code extension<a aria-hidden="true" href="#vs-code-extension">#</a></h4>
<p>The <a href="https://marketplace.visualstudio.com/items?itemName=rstack.rstest" target="_blank" rel="noopener noreferrer">Rstest VS Code Extension</a> is now available. It allows you to discover, run, and debug tests directly within the editor, helping you efficiently manage test cases and quickly review test results.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-6-rstest-vscode-ext.gif" alt="rstest-vscode-extension"></img></p>
<h4 id="coverage-support">Coverage support<a aria-hidden="true" href="#coverage-support">#</a></h4>
<p>Rstest now supports collecting code coverage using Istanbul and generating detailed coverage reports. For more information, see <a href="https://rstest.rs/config/test/coverage" target="_blank" rel="noopener noreferrer">Rstest – Coverage</a>.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-6-rstest-cov.png" alt="rstest-coverage"></img></p>
<h3 id="rsdoctor-13">Rsdoctor 1.3<a aria-hidden="true" href="#rsdoctor-13">#</a></h3>
<h4 id="rsdoctor-github-actions">Rsdoctor GitHub Actions<a aria-hidden="true" href="#rsdoctor-github-actions">#</a></h4>
<p>Rsdoctor now provides a <a href="https://github.com/web-infra-dev/rsdoctor-action" target="_blank" rel="noopener noreferrer">GitHub bundle diff action</a>, which automatically detects and compares bundle size changes during the CI phase. This helps teams identify and prevent bundle size regressions early.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-6-bundle-diff.png" alt="Rsdoctor GitHub Actions"></img></p>
<h4 id="all-in-one-json-report">All-in-one JSON report<a aria-hidden="true" href="#all-in-one-json-report">#</a></h4>
<p>Rsdoctor now supports exporting a <a href="https://rsdoctor.rs/config/options/output#mode-brief" target="_blank" rel="noopener noreferrer">all-in-one JSON report file</a> in Brief mode. This file can be easily stored, shared, or used for further data analysis. In addition, we’ve introduced a new <a href="https://rsdoctor.rs/guide/start/playground" target="_blank" rel="noopener noreferrer">Playground page</a>, where developers can upload the JSON report to reopen and visually explore the analysis results.</p>
<h2 id="ecosystem">Ecosystem<a aria-hidden="true" href="#ecosystem">#</a></h2>
<h3 id="next-rspack">next-rspack<a aria-hidden="true" href="#next-rspack">#</a></h3>
<p>In Next.js 16, next-rspack has integrated Rspack's <a href="https://github.com/rstackjs/rspack-binding-template" target="_blank" rel="noopener noreferrer">custom Rust binding solution</a>, delivering significant performance gains:</p>
<ul>
<li>24% faster build performance</li>
<li>10% faster dev performance</li>
</ul>
<p>In this customized Rspack Rust binding, the <code>externals</code> logic from Next.js has been moved to the Rust side, greatly reducing communication overhead between JavaScript and Rust.</p>
<table>
<thead>
<tr>
<th>Tool</th>
<th>Build time (no cache)</th>
<th>Dev time (no cache)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Rspack (next@16.0.0)</td>
<td>3.8s</td>
<td>1.7s</td>
</tr>
<tr>
<td>Rspack (next@15.4.0)</td>
<td>5.0s</td>
<td>1.9s</td>
</tr>
<tr>
<td>webpack</td>
<td>14.0s</td>
<td>7.8s</td>
</tr>
</tbody>
</table>
<p>The benchmark is based on the <a href="https://github.com/SyMind/chakra-ui-docs/tree/next-rspack" target="_blank" rel="noopener noreferrer">chakra-ui-docs</a> repository. Full performance data is available here: <a href="https://github.com/SyMind/chakra-ui-docs/blob/next-rspack/PERF.md" target="_blank" rel="noopener noreferrer">PERF.md</a>.</p>
<h2 id="upgrade-guide">Upgrade guide<a aria-hidden="true" href="#upgrade-guide">#</a></h2>
<h3 id="upgrade-swc-plugins">Upgrade SWC plugins<a aria-hidden="true" href="#upgrade-swc-plugins">#</a></h3>
<p>If your project uses SWC Wasm plugins (such as <code>@swc/plugin-emotion</code>), you need to upgrade the plugins to a version compatible with <code>swc_core@46</code>, otherwise it may cause build errors due to version incompatibility.</p>
<blockquote>
<p>For more details, see <a href="/errors/swc-plugin-version">FAQ - SWC plugin version mismatch</a>.</p>
</blockquote>
<h3 id="remove-experimentslayer">Remove <code>experiments.layer</code><a aria-hidden="true" href="#remove-experimentslayer">#</a></h3>
<p><code>experiments.layer</code> option has been deprecated, you can remove it directly:</p>
<pre><code meta="">export default {
-  experiments: {
-   layer: true,
-  },
};
</code></pre>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.5]]></title>
            <link>https://rspack.rs/blog/announcing-1-5</link>
            <guid>/blog/announcing-1-5</guid>
            <pubDate>Tue, 26 Aug 2025 11:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>August 26, 2025</em></p>
<h1 id="announcing-rspack-15">Announcing Rspack 1.5<a aria-hidden="true" href="#announcing-rspack-15">#</a></h1>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-5.png" alt="Rspack 1.5"></img></p>
<hr></hr>
<p>We're excited to announce Rspack 1.5!</p>
<p>Notable changes include:</p>
<ul>
<li>New features
<ul>
<li><a href="#barrel-file-optimization">Barrel file optimization</a></li>
<li><a href="#faster-file-system-watcher">Faster file system watcher</a></li>
<li><a href="#improved-browser-support">Improved browser support</a></li>
<li><a href="#extending-rspack-with-rust">Extending Rspack with Rust</a></li>
<li><a href="#const-inline-optimization">Const inline optimization</a></li>
<li><a href="#type-re-export-analysis">Type re-export analysis</a></li>
<li><a href="#built-in-virtual-modules-plugin">Built-in virtual modules plugin</a></li>
<li><a href="#module-federation-runtime-hoisting">Module Federation runtime hoisting</a></li>
<li><a href="#installation-size-optimization">Installation size optimization</a></li>
<li><a href="#seal-phase-performance-optimization">Seal phase performance optimization</a></li>
</ul>
</li>
<li>Misc
<ul>
<li><a href="#drop-support-for-nodejs-16">Drop support for Node.js 16</a></li>
<li><a href="#resolver-javascript-api">Resolver JavaScript API</a></li>
</ul>
</li>
<li>Rstack progress
<ul>
<li><a href="#rslint-released">Rslint released</a></li>
<li><a href="#rsbuild-15">Rsbuild 1.5</a></li>
<li><a href="#rslib-012">Rslib 0.12</a></li>
<li><a href="#rspress-20-beta">Rspress 2.0 beta</a></li>
<li><a href="#rsdoctor-12">Rsdoctor 1.2</a></li>
<li><a href="#rstest-02">Rstest 0.2</a></li>
</ul>
</li>
</ul>
<h2 id="new-features">New features<a aria-hidden="true" href="#new-features">#</a></h2>
<h3 id="barrel-file-optimization">Barrel file optimization<a aria-hidden="true" href="#barrel-file-optimization">#</a></h3>
<p>A <strong>barrel file</strong> is a common module export pattern that re-exports multiple modules through a single entry file, typically named <code>index.js</code> or <code>index.ts</code>. For example:</p>
<pre><code>export { Button, Tab } from &#39;./components&#39;;
export * as utils from &#39;./utils&#39;;
export * from &#39;./hooks&#39;;
</code></pre>
<p>While this pattern simplifies module imports, it can introduce performance overhead during the build process: when importing a single module from a barrel file, Rspack must resolve and build all modules referenced by the barrel file, even if only a small subset is actually used.</p>
<p>To address this, Rspack 1.5 introduces the experimental <a href="/config/experiments#experimentslazybarrel">lazyBarrel</a> feature. This optimization automatically detects side-effect free barrel files and defers building their re-exports until actually needed. Modules are only resolved and built when actually needed, significantly reducing unnecessary module resolution and build costs.</p>
<p>This is particularly effective for projects with many barrel files, significantly improving build performance.</p>
<pre><code meta="">export default {
  experiments: {
    lazyBarrel: true,
  },
};
</code></pre>
<p>Real-world benchmarks show that barrel file optimization delivers substantial performance gains across applications at different scales:</p>
<ul>
<li><a href="https://github.com/rstackjs/build-tools-performance/tree/main/cases/ui-components" target="_blank" rel="noopener noreferrer">Benchmark</a>:</li>
</ul>
<table>
<thead>
<tr>
<th>Metric</th>
<th align="right">Before</th>
<th align="right">After</th>
<th align="right">Improvement</th>
</tr>
</thead>
<tbody>
<tr>
<td>Build Time</td>
<td align="right">1.47s</td>
<td align="right">1.19s</td>
<td align="right"><code>-20%</code></td>
</tr>
<tr>
<td>Module Resolutions</td>
<td align="right">39,675</td>
<td align="right">20,071</td>
<td align="right"><code>-49%</code></td>
</tr>
<tr>
<td>Module Builds</td>
<td align="right">9,358</td>
<td align="right">5,062</td>
<td align="right"><code>-46%</code></td>
</tr>
</tbody>
</table>
<ul>
<li>An application from ByteDance:</li>
</ul>
<table>
<thead>
<tr>
<th>Metric</th>
<th align="right">Before</th>
<th align="right">After</th>
<th align="right">Improvement</th>
</tr>
</thead>
<tbody>
<tr>
<td>Build Time</td>
<td align="right">17.9s</td>
<td align="right">16.0s</td>
<td align="right"><code>-10%</code></td>
</tr>
<tr>
<td>Module Resolutions</td>
<td align="right">181,078</td>
<td align="right">137,232</td>
<td align="right"><code>-24%</code></td>
</tr>
<tr>
<td>Module Builds</td>
<td align="right">38,046</td>
<td align="right">29,405</td>
<td align="right"><code>-23%</code></td>
</tr>
</tbody>
</table>
<p>Barrel file optimization is enabled by default in Rsbuild 1.5, and we plan to make it the default for all projects in Rspack 1.6.</p>
<p>For more details, see the <a href="/config/experiments#experimentslazybarrel">experiments.lazyBarrel documentation</a>.</p>
<h3 id="faster-file-system-watcher">Faster file system watcher<a aria-hidden="true" href="#faster-file-system-watcher">#</a></h3>
<p>Previously, Rspack relied on the <a href="https://github.com/webpack/watchpack" target="_blank" rel="noopener noreferrer">watchpack</a> file system watcher to track file changes. However, we identified performance bottlenecks with <code>watchpack</code>. For example, each file change triggers the creation of a new instance, consuming significant CPU and memory in large projects (see <a href="https://github.com/web-infra-dev/rspack/issues/7490" target="_blank" rel="noopener noreferrer">#7490</a>).</p>
<p>To address this, we built a native file system watcher in Rust, offering the following benefits:</p>
<ul>
<li><strong>High performance</strong>: HMR performance improvements of up to 50%</li>
<li><strong>Incremental updates</strong>: Only processes files that actually change</li>
<li><strong>Persistent runtime</strong>: Runs continuously throughout development without reinitialization</li>
</ul>
<p>You can try out the new watcher by enabling <a href="/config/experiments#experimentsnativewatcher">experiments.nativeWatcher</a>:</p>
<pre><code meta="">export default {
  experiments: {
    nativeWatcher: true,
  },
  watchOptions: {
    // Other watch options...
  },
};
</code></pre>
<h3 id="improved-browser-support">Improved browser support<a aria-hidden="true" href="#improved-browser-support">#</a></h3>
<p>In Rspack 1.4, we officially introduced Wasm target support, enabling Rspack to run in browser-based environments powered by WebContainers, such as <a href="https://stackblitz.com/" target="_blank" rel="noopener noreferrer">StackBlitz</a>.</p>
<p>With the release of <a href="/api/javascript-api/browser">@rspack/browser</a>, you can now run Rspack directly in any modern browser without relying on WebContainers or specific platforms.</p>
<p><code>@rspack/browser</code> is designed specifically for pure browser environments, providing core bundling capabilities for web projects. It offers a lightweight way to reproduce issues, share configurations, and help developers get started with Rspack through interactive online demos.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-5-repl.rspack.png" alt="rspack-web-repl"></img></p>
<p>The API of <code>@rspack/browser</code> is aligned with the JavaScript API of <code>@rspack/core</code>, with additional features and APIs tailored for browser environments.</p>
<pre><code>

// Write files to memfs
builtinMemFs.volume.fromJSON({
  // ...project files
});

// Just like using JavaScript API of @rspack/core
rspack({}, (err, stats) =&gt; {
  if (err || stats.hasErrors()) {
    // ...
  }
  // Get output from memfs after bundling
  const files = builtinMemFs.volume.toJSON();
});
</code></pre>
<p><code>@rspack/browser</code> is currently in an experimental stage and may introduce breaking changes. We will continue to enhance its capabilities for online bundling scenarios. In the meantime, Welcome to try it out at the <a href="https://playground.rspack.rs/" target="_blank" rel="noopener noreferrer">Rspack Playground</a>.</p>
<h3 id="extending-rspack-with-rust">Extending Rspack with Rust<a aria-hidden="true" href="#extending-rspack-with-rust">#</a></h3>
<p>You can now extend Rspack directly using Rust! With our provided repository template, you can build custom Rust plugins and loaders, and even replace Rspack's default native binding.</p>
<p>In JavaScript plugins, data transfer and type conversion between Rust and JavaScript can introduce performance overhead. By customizing Rspack's binding, your code can integrate directly with the Rspack Rust core, eliminating cross-language communication costs while retaining full support for all Rspack JavaScript APIs.</p>
<p>This approach is particularly suitable for replacing hooks that frequently interact with Rust (such as <code>compilation.hooks.processAssets</code>) and for compute-intensive custom loaders, where it can deliver significant build performance improvements.</p>
<p>Key benefits:</p>
<ul>
<li><strong>Native performance</strong> — Extensions written in Rust run with the same native performance as the Rspack Rust core.</li>
<li><strong>Full compatibility</strong> — Retains all existing JavaScript APIs without requiring changes to your project.</li>
<li><strong>Developer-friendly</strong> — The official template includes a complete development environment and publishing workflow.</li>
</ul>
<p>You can get started quickly with the <a href="https://github.com/rstackjs/rspack-binding-template" target="_blank" rel="noopener noreferrer">official template</a>. For more details, see the <a href="https://rstackjs.github.io/rspack-rust-book/custom-binding/getting-started/rationale.html" target="_blank" rel="noopener noreferrer">design rationale</a>. Note that this approach introduces additional maintenance costs and is recommended only when extreme performance optimization is required.</p>
<h3 id="const-inline-optimization">Const inline optimization<a aria-hidden="true" href="#const-inline-optimization">#</a></h3>
<p>When organizing project code, it is common to centralize constants into files such as <code>constants.js</code> or, in TypeScript projects, into <code>types.ts</code> files containing enums.</p>
<p>Rspack introduces two experimental features — <a href="/config/experiments#experimentsinlineconst">experiments.inlineConst</a> and <a href="/config/experiments#experimentsinlineenum">experiments.inlineEnum</a> — that perform <strong>cross-module inlining optimizations for constants</strong>. These optimizations help minifiers perform more accurate static analysis, eliminate unused code branches, and further reduce bundle size.</p>
<p>For example, <code>inlineConst</code> can inline constants defined in leaf modules of the module graph across modules, as shown below:</p>
<pre><code>// font-settings.js
export const bold = 0b001;
export const italic = 0b010;

// index.js


// MY_FONT is defined by DefinePlugin({ FONT: 0b001 })
const fontStyle = {};
if (MY_FONT &amp; bold) fontStyle[&#39;font-weight&#39;] = &#39;bold&#39;;
if (MY_FONT &amp; italic) fontStyle[&#39;font-style&#39;] = &#39;italic&#39;;
applyFont(fontStyle);
</code></pre>
<p>With <code>inlineConst</code> enabled, the <code>if</code> branches in the example can be clearly optimized by minifier, generating more streamlined output:</p>
<pre><code>(() =&gt; {
  &#39;use strict&#39;;
  let t = {};
  t[&#39;font-weight&#39;] = &#39;bold&#39;;
  applyFont(t);
})();
</code></pre>
<blockquote>
<p>For more details, see the <a href="/config/experiments#experimentsinlineconst">experiments.inlineConst documentation</a>. This feature is planned to be enabled by default in v1.6.</p>
</blockquote>
<p><code>inlineEnum</code> performs <strong>cross-module inlining optimization for TypeScript enums</strong>, working in a similar way to <code>inlineConst</code>.</p>
<pre><code>// types.ts
export enum Kind {
  A,
  B,
}
// index.ts

console.log(Kind.A);
</code></pre>
<p>With <code>inlineEnum</code> enabled:</p>
<pre><code>(() =&gt; {
  console.log(0);
})();
</code></pre>
<p>Note that when <code>inlineEnum</code> is enabled, Rspack will inline all enums by default.
If you only want to inline <code>const enums</code>, please refer to this <a href="https://github.com/rstackjs/rstack-examples/tree/main/rspack/inline-const-enum" target="_blank" rel="noopener noreferrer">example</a>.</p>
<blockquote>
<p>For more details, see the <a href="/config/experiments#experimentsinlineenum">experiments.inlineEnum documentation</a>.</p>
</blockquote>
<h3 id="type-re-export-analysis">Type re-export analysis<a aria-hidden="true" href="#type-re-export-analysis">#</a></h3>
<p>In TypeScript projects, type re-exports are a common pattern:</p>
<pre><code>// index.ts
export { MyType } from &#39;./types.ts&#39;;

// types.ts
export type MyType = {
  name: string;
};
</code></pre>
<p>In previous versions, if you re-exported a type without adding the <code>type</code> modifier, Rspack could throw a warning such as: <code>export &#39;MyType&#39; (reexported as &#39;MyType&#39;) was not found</code>.</p>
<p>This happened because Rspack processed each module in isolation. As a result, a type export (like <code>MyType</code> in the example) could be mistakenly treated as a value. Since no corresponding value export was found in <code>./types.ts</code>, the warning was triggered.</p>
<p>Rspack 1.5 introduces the <a href="/config/experiments#experimentstypereexportspresence">experiments.typeReexportsPresence</a> option, which improves the detection of TypeScript type exports. With this option enabled, Rspack can correctly recognize type re-exports across modules, preventing false warnings.</p>
<blockquote>
<p>For more details, see the <a href="/config/experiments#experimentstypereexportspresence">experiments.typeReexportsPresence documentation</a>.</p>
</blockquote>
<h3 id="built-in-virtual-modules-plugin">Built-in virtual modules plugin<a aria-hidden="true" href="#built-in-virtual-modules-plugin">#</a></h3>
<p>In Rspack 1.4, we introduced <a href="/blog/announcing-1-4#custom-input-file-system">custom InputFileSystem</a>, which combined with the <code>webpack-virtual-modules</code> plugin, enabled support for virtual modules. However, this approach still had performance bottlenecks when dealing with a large number of virtual modules.</p>
<p>To address this, Rspack 1.5 adds a built-in <a href="/plugins/rspack/virtual-modules-plugin">VirtualModulesPlugin</a>.</p>
<p>This plugin is implemented in Rust and moves the storage and management of virtual modules to the Rust layer. This reduces module read and parse overhead. As a result, it delivers significantly better performance when handling large volumes of virtual modules.</p>
<p>The <code>VirtualModulesPlugin</code> retains API compatibility with <code>webpack-virtual-modules</code>, making migration straightforward:</p>
<pre><code meta="">

export default {
  plugins: [
    new rspack.experiments.VirtualModulesPlugin({
      'src/generated/config.js': 'export default { version: "1.0.0" };',
    }),
  ],
};
</code></pre>
<blockquote>
<p>Thanks to our contributor <a href="https://github.com/nilptr" target="_blank" rel="noopener noreferrer">@nilptr</a> for his great <a href="https://github.com/web-infra-dev/rspack/pull/11021" target="_blank" rel="noopener noreferrer">work</a>.</p>
</blockquote>
<h3 id="module-federation-runtime-hoisting">Module Federation runtime hoisting<a aria-hidden="true" href="#module-federation-runtime-hoisting">#</a></h3>
<p>Previously, the Module Federation runtime was bootstrapped by patching the entry module.
In the new version, the Module Federation plugin integrates its runtime code directly with Rspack's runtime and elevates it into the runtime chunk.
This ensures that the Module Federation runtime is prepared before the application starts.</p>
<p>This change brings the following benefits:</p>
<ol>
<li>Reduced bundle size in multi-entry scenarios</li>
<li>Fixed initialization errors related to Module Federation</li>
<li>Support for extracting the Module Federation runtime into the runtime chunk</li>
<li>A new hook-based plugin system for extensibility</li>
</ol>
<p>The table below shows bundle size optimizations in a demo project using the new Module Federation plugin:</p>
<table>
<thead>
<tr>
<th align="left">Configuration</th>
<th align="right">Before</th>
<th align="right">After</th>
<th align="right">Reduction</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">Multiple Entries (default)</td>
<td align="right">210kb</td>
<td align="right">210kb</td>
<td align="right"><code>0%</code></td>
</tr>
<tr>
<td align="left">Multiple Entries + runtimeChunk: true</td>
<td align="right">210kb</td>
<td align="right">150kb</td>
<td align="right"><code>29%</code></td>
</tr>
<tr>
<td align="left">Multiple Entries + runtimeChunk: 'single'</td>
<td align="right">210kb</td>
<td align="right">70kb</td>
<td align="right"><code>67%</code></td>
</tr>
</tbody>
</table>
<p>More details about this change can be found <a href="https://gist.github.com/ScriptedAlchemy/a71ccbdfb933e8a4cd0131801a2c26b5#file-hoisted-runtime-internal-md" target="_blank" rel="noopener noreferrer">here</a>,</p>
<h3 id="installation-size-optimization">Installation size optimization<a aria-hidden="true" href="#installation-size-optimization">#</a></h3>
<p>Since v1.4, we have delivered several key optimizations to reduce Rspack's installation size, decreasing the size from <code>63.7MB</code> in Rspack 1.4.0 to <code>49.9MB</code> in Rspack 1.5.0.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-5-rspack-install-size.png" alt="binary-size-by-dates"></img></p>
<p>Some of the most impactful optimizations include:</p>
<ul>
<li><strong>5 MB reduction</strong> through <a href="https://github.com/web-infra-dev/rspack/pull/11077" target="_blank" rel="noopener noreferrer">compiler parameter adjustments</a></li>
<li><strong>3 MB reduction</strong> by optimizing upstream dependencies (<a href="https://github.com/wasmerio/wasmer/pull/5621/files" target="_blank" rel="noopener noreferrer">wasmer</a>, <a href="https://github.com/swc-project/swc/pull/10638" target="_blank" rel="noopener noreferrer">SWC</a>)</li>
<li><strong>2 MB reduction</strong> via <a href="https://github.com/web-infra-dev/rspack/pull/10965" target="_blank" rel="noopener noreferrer">feature flag optimization</a></li>
<li><strong>2 MB reduction</strong> through <a href="https://github.com/browserslist/browserslist-rs/pull/32" target="_blank" rel="noopener noreferrer">browserslist-rs</a> data structure improvements</li>
</ul>
<p>To further optimize installation size, we have integrated <a href="https://github.com/web-infra-dev/rspack/blob/main/.github/actions/binary-limit/action.yml" target="_blank" rel="noopener noreferrer">automated size checks</a> into our daily workflow to continuously monitor changes in this metric.</p>
<h3 id="seal-phase-performance-optimization">Seal phase performance optimization<a aria-hidden="true" href="#seal-phase-performance-optimization">#</a></h3>
<p>In terms of build performance, Rspack 1.5 delivers major optimizations to the Seal phase (the stage responsible for code generation and optimization).
By improving data structures, increasing parallelism, and introducing hot code caching, Rspack significantly improves build efficiency for large projects. Thanks to parallelization, the performance gains are even more pronounced on multi-core machines.</p>
<p>For example, in a large-scale application at ByteDance containing approximately 40,000 modules, the overall Seal phase time was reduced by <strong>around 50%</strong>, with substantial improvements observed across all major sub-stages:</p>
<table>
<thead>
<tr>
<th>Phase</th>
<th align="right">v1.4.0</th>
<th align="right">v1.5.0</th>
<th align="right">Improvement</th>
</tr>
</thead>
<tbody>
<tr>
<td>Flag dependency exports</td>
<td align="right">394ms</td>
<td align="right">181ms</td>
<td align="right"><code>-54%</code></td>
</tr>
<tr>
<td>Flag dependency usage</td>
<td align="right">1828ms</td>
<td align="right">454ms</td>
<td align="right"><code>-75%</code></td>
</tr>
<tr>
<td>Code splitting</td>
<td align="right">2019ms</td>
<td align="right">777ms</td>
<td align="right"><code>-62%</code></td>
</tr>
<tr>
<td>Bundle splitting</td>
<td align="right">1588ms</td>
<td align="right">712ms</td>
<td align="right"><code>-55%</code></td>
</tr>
<tr>
<td>Module concatenation</td>
<td align="right">2645ms</td>
<td align="right">616ms</td>
<td align="right"><code>-76%</code></td>
</tr>
<tr>
<td>Content hash calculation</td>
<td align="right">881ms</td>
<td align="right">404ms</td>
<td align="right"><code>-54%</code></td>
</tr>
</tbody>
</table>
<h2 id="misc">Misc<a aria-hidden="true" href="#misc">#</a></h2>
<h3 id="drop-support-for-nodejs-16">Drop support for Node.js 16<a aria-hidden="true" href="#drop-support-for-nodejs-16">#</a></h3>
<p>Since Node.js 16 reached its end of life on September 11, 2023, and many community packages (such as <code>webpack-dev-server</code>, <code>css-loader</code>, <code>sass-loader</code>, etc.) have dropped support for Node.js 16, <strong>Rspack 1.5 drops support for Node.js 16</strong> to reduce maintenance costs.</p>
<p>Node.js version requirements for each package:</p>
<table>
<thead>
<tr>
<th>Package</th>
<th align="right">v1.4</th>
<th align="right">v1.5</th>
</tr>
</thead>
<tbody>
<tr>
<td>@rspack/core</td>
<td align="right"><code>&gt;=16.0.0</code></td>
<td align="right"><code>&gt;=18.12.0</code></td>
</tr>
<tr>
<td>@rspack/cli</td>
<td align="right"><code>&gt;=18.12.0</code></td>
<td align="right"><code>&gt;=18.12.0</code></td>
</tr>
<tr>
<td>@rspack/dev-server</td>
<td align="right"><code>&gt;=18.12.0</code></td>
<td align="right"><code>&gt;=18.12.0</code></td>
</tr>
<tr>
<td>@rsbuild/core</td>
<td align="right"><code>&gt;=16.10.0</code></td>
<td align="right"><code>&gt;=18.12.0</code></td>
</tr>
</tbody>
</table>
<div><div>TIP</div><div><p>⚠️ This is a breaking change. If you are currently using Node.js 16, you will need to upgrade to Node.js 18.12.0 or higher in order to use Rspack 1.5.</p></div></div>
<p>For projects still running on Node.js 16, please follow these steps to upgrade:</p>
<ol>
<li><strong>Upgrade Node.js version</strong>: We recommend upgrading to Node.js 18.12.0 or later (Node.js 22 LTS is recommended).</li>
<li><strong>Update CI/CD configuration</strong>: Ensure your continuous integration setup is updated to use a compatible Node.js version.</li>
</ol>
<h3 id="resolver-javascript-api">Resolver JavaScript API<a aria-hidden="true" href="#resolver-javascript-api">#</a></h3>
<p>To make it easier for our users to leverage Rspack's module resolution capabilities, we have integrated <a href="https://github.com/rstackjs/rspack-resolver" target="_blank" rel="noopener noreferrer">rspack-resolver</a> into the Rspack JavaScript API.
It provides module resolution functionality similar to <a href="https://github.com/webpack/enhanced-resolve" target="_blank" rel="noopener noreferrer">enhanced-resolve</a>.</p>
<p>For usage details, please refer to the <a href="/api/javascript-api/resolver#resolver-api">Resolver API documentation</a>.</p>
<h3 id="stabilization-of-lazy-compilation">Stabilization of lazy compilation<a aria-hidden="true" href="#stabilization-of-lazy-compilation">#</a></h3>
<p>After extensive validation, the <a href="/config/experiments#experimentslazycompilation">experiments.lazyCompilation</a> option has been promoted from an experimental feature to a stable feature, and is now available at the top level of the Rspack configuration:</p>
<pre><code meta="">export default {
- experiments: {
-   lazyCompilation: true,
- },
+ lazyCompilation: true,
};
</code></pre>
<p>The previous experiments.lazyCompilation option will continue to work, but will emit a deprecation warning.</p>
<h3 id="deprecated-options">Deprecated options<a aria-hidden="true" href="#deprecated-options">#</a></h3>
<p>The Rspack <a href="/config/experiments#experimentstoplevelawait">experiments.topLevelAwait</a> option was used to control support for top-level await, and it has always been enabled by default.
After careful observation, we found no real-world scenarios where disabling top-level await was necessary.</p>
<p>As a result, this option has been deprecated and is planned for removal in Rspack 2.0, at that point top-level await support can no longer be disabled.</p>
<h2 id="rstack-progress">Rstack progress<a aria-hidden="true" href="#rstack-progress">#</a></h2>
<p><a href="/guide/start/ecosystem#rstack">Rstack</a> is a unified JavaScript toolchain centered on Rspack, with high performance and consistent architecture.</p>
<h3 id="rslint-released">Rslint released<a aria-hidden="true" href="#rslint-released">#</a></h3>
<p><img src="https://assets.rspack.rs/rslint/rslint-banner.png" alt="rslint-banner"></img></p>
<p>We are excited to announce the release of <a href="https://rslint.rs/" target="_blank" rel="noopener noreferrer">Rslint</a>!</p>
<p>Rslint is a next-generation, TypeScript-first linter, written in Go and powered by the type-checking capabilities of typescript-go.</p>
<p>It originates from <a href="https://github.com/typescript-eslint/tsgolint" target="_blank" rel="noopener noreferrer">tsgolint</a>, created by <a href="https://github.com/auvred" target="_blank" rel="noopener noreferrer">@auvred</a>, and has since been extended and optimized to deliver a more powerful linting experience.</p>
<p>Key features of Rslint include:</p>
<ul>
<li><strong>ESLint-style configuration and directives</strong>: almost seamless adoption</li>
<li><strong>IDE support</strong>: VS Code extension available, with support for Cursor, Trae, and more</li>
<li><strong>Auto-fix</strong>: resolve issues instantly with <code>rslint --fix</code></li>
<li><strong>Rule support</strong>: 50+ <code>@typescript-eslint</code> rules already implemented</li>
<li><strong>Test validation</strong>: runs the original <code>typescript-eslint</code> test suite to ensure rule correctness</li>
</ul>
<p>Rslint is still in its early stage of development, and we are actively working on expanding its feature set and rule support.</p>
<p>We encourage you to try it out and provide feedback to help us improve Rslint together!</p>
<h3 id="rsbuild-15">Rsbuild 1.5<a aria-hidden="true" href="#rsbuild-15">#</a></h3>
<p>Providing an out-of-the-box experience has always been a core design principle of Rsbuild. In Rsbuild 1.5, we have enabled several of Rspack's latest features by default, delivering improved build performance, including:</p>
<ul>
<li>Enabled <a href="/config/lazy-compilation">lazyCompilation</a> to compile dynamically imported modules on demand, improving development server startup speed.</li>
<li>Enabled <a href="/config/experiments#experimentslazybarrel">lazyBarrel</a> to optimize the build performance of barrel files and reduce unnecessary module resolution.</li>
<li>Enabled <a href="/config/experiments#experimentsinlineenum">inlineEnum</a> to inline TypeScript enums, reducing the bundle size after compilation.</li>
<li>Enabled <a href="/config/experiments#experimentsinlineenum">typeReexportsPresence</a> to correctly detect TypeScript type re-exports, improving type handling accuracy.</li>
</ul>
<blockquote>
<p>Once you upgrade to the latest version of Rsbuild, these features are enabled by default with no additional configuration required.</p>
</blockquote>
<p>Rsbuild 1.5 also introduces the new <a href="https://rsbuild.rs/config/output/module" target="_blank" rel="noopener noreferrer">output.module</a> option, which allows generating build outputs in the ES modules format.</p>
<p>Currently, this option provides ESM format support for Node.js bundles. We plan to extend support to web applications in future releases.</p>
<pre><code meta="">export default {
  output: {
    target: 'node',
    module: true,
  },
};
</code></pre>
<h3 id="rslib-012">Rslib 0.12<a aria-hidden="true" href="#rslib-012">#</a></h3>
<p>In Rslib 0.12, we have integrated the Rstest testing framework into the project template. If needed, you can use Rstest to test your library projects, enabling development and testing through a unified Rstack toolchain.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-5-rslib-using-rstest.png" alt="Using Rstest"></img></p>
<p>In addition, we are actively designing and developing a new ESM output generation strategy, aiming to deliver ESM output quality comparable to tools like esbuild and Rollup, while keeping webpack-compatible interop behavior to ensure correctness. See <a href="https://jserfeng.github.io/interop-test/by-test-case" target="_blank" rel="noopener noreferrer">interop tests</a> for details.</p>
<h3 id="rspress-20-beta">Rspress 2.0 beta<a aria-hidden="true" href="#rspress-20-beta">#</a></h3>
<p>Rspress 2.0 is now in beta, with development nearing completion. We plan to release the stable version within the next two months.</p>
<p>The latest beta introduces a Markdown text copy component, making it easier for users to provide documentation content to large language models for analysis and processing. You can try out this feature on various Rstack documentation sites:</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-5-rspress-plugin-llms-ui.png" alt="plugin-llms Demo"></img></p>
<blockquote>
<p>This feature is powered by the @rspress/plugin-llms plugin, which automatically generates files compliant with the <a href="https://llmstxt.org/" target="_blank" rel="noopener noreferrer">llms.txt</a> standard. For usage details, please refer to the <a href="https://v2.rspress.rs/plugin/official-plugins/llms" target="_blank" rel="noopener noreferrer">@rspress/plugin-llms documentation</a>.</p>
</blockquote>
<h3 id="rsdoctor-12">Rsdoctor 1.2<a aria-hidden="true" href="#rsdoctor-12">#</a></h3>
<p>Rsdoctor 1.2 introduces several significant updates, including precise analysis of concatenated modules and an all-new Treemap visualization. These enhancements improve both the accuracy of build artifact analysis and the visualization experience, helping you better understand and optimize your project bundles.</p>
<p>Read more in the <a href="https://rsdoctor.rs/blog/release/release-note-1_2" target="_blank" rel="noopener noreferrer">Rsdoctor 1.2 release blog</a>.</p>
<h3 id="rstest-02">Rstest 0.2<a aria-hidden="true" href="#rstest-02">#</a></h3>
<p>After two months of continuous iteration and over 10 rounds of optimization, Rstest 0.2 delivers substantial improvements in both functionality and stability. This release introduces the following key enhancements:</p>
<ul>
<li><strong>Mock API</strong>: Rstest now includes a comprehensive <a href="https://rstest.rs/api/rstest/mockModules" target="_blank" rel="noopener noreferrer">mock API</a>, enabling developers to replace actual module implementations in test environments, with full support for mocking ES modules.</li>
<li><strong>Enhanced Watch Mode</strong>: Watch mode now supports incremental re-runs. When a test file or its dependencies change, Rstest intelligently re-executes only the affected tests, significantly improving testing efficiency.</li>
<li><strong>CLI Shortcuts</strong>: Watch mode also introduces keyboard shortcuts, allowing developers to perform common actions more quickly and seamlessly.</li>
</ul>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-5-rstest-cli-shortcuts.png" alt="Rstest Shortcuts"></img></p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.4]]></title>
            <link>https://rspack.rs/blog/announcing-1-4</link>
            <guid>/blog/announcing-1-4</guid>
            <pubDate>Thu, 26 Jun 2025 16:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>June 26, 2025</em></p>
<h1 id="announcing-rspack-14">Announcing Rspack 1.4<a aria-hidden="true" href="#announcing-rspack-14">#</a></h1>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-4.png" alt="Rspack 1.4"></img></p>
<hr></hr>
<p>Rspack 1.4 has been released!</p>
<p>Notable changes:</p>
<ul>
<li>New features
<ul>
<li><a href="#running-in-the-browser">Running in the browser</a></li>
<li><a href="#faster-swc">Faster SWC</a></li>
<li><a href="#smaller-bundles">Smaller bundles</a></li>
<li><a href="#incremental-build-by-default">Incremental build by default</a></li>
<li><a href="#new-csschunkingplugin">New CssChunkingPlugin</a></li>
<li><a href="#enhanced-lazy-compilation">Enhanced lazy compilation</a></li>
<li><a href="#custom-input-file-system">Custom input file system</a></li>
<li><a href="#performance-analysis-tool">Performance analysis tool</a></li>
</ul>
</li>
<li>Rstack progress
<ul>
<li><a href="#rsbuild-14">Rsbuild 1.4</a></li>
<li><a href="#rslib-010">Rslib 0.10</a></li>
<li><a href="#rspress-20-beta">Rspress 2.0 beta</a></li>
<li><a href="#rsdoctor-mcp">Rsdoctor MCP</a></li>
<li><a href="#rstest-released">Rstest released</a></li>
</ul>
</li>
<li>Ecosystem
<ul>
<li><a href="#next-rspack">next-rspack</a></li>
<li><a href="#kmi">Kmi</a></li>
</ul>
</li>
<li>Upgrade guide</li>
</ul>
<h2 id="new-features">New features<a aria-hidden="true" href="#new-features">#</a></h2>
<h3 id="running-in-the-browser">Running in the browser<a aria-hidden="true" href="#running-in-the-browser">#</a></h3>
<p>Starting with Rspack 1.4, we have added Wasm target support, which means Rspack can now run in browser environments, including online platforms like <a href="https://stackblitz.com/" target="_blank" rel="noopener noreferrer">StackBlitz</a> (<a href="https://blog.stackblitz.com/posts/introducing-webcontainers/" target="_blank" rel="noopener noreferrer">WebContainers</a>). This enables developers to quickly create prototypes and share code examples without having to configure local environments.</p>
<p>You can try out our <a href="https://stackblitz.com/~/github.com/rstackjs/rsbuild-stackblitz-example" target="_blank" rel="noopener noreferrer">online example</a> directly, or learn about the StackBlitz usage guide in <a href="/guide/start/quick-start#preview-with-stackblitz">this documentation</a>.</p>

<p>In future versions, we will continue to optimize the Wasm version's usability and bundle size.</p>
<p>We are also developing the <code>@rspack/browser</code> package, which is a browser-specific version of Rspack, allowing you to use Rspack directly in any modern browser without relying on WebContainers or specific platforms.</p>
<h3 id="faster-swc">Faster SWC<a aria-hidden="true" href="#faster-swc">#</a></h3>
<p>Over the past few months, we have been continuously collaborating with the SWC team to optimize the performance and reliability of the JavaScript toolchain. After a period of optimization, we are pleased to see that SWC's performance has improved significantly, benefiting both Rspack users and all SWC-based tools:</p>
<ul>
<li>JavaScript parser is <strong>30%-35%</strong> faster</li>
<li>JavaScript minifier is <strong>10%</strong> faster</li>
</ul>

<blockquote>
<p>The above data is from: <a href="https://codspeed.io/swc-project/swc" target="_blank" rel="noopener noreferrer">CodSpeed - SWC</a>, compared against SWC 16 used by Rspack 1.3 as the baseline.</p>
</blockquote>
<h3 id="smaller-bundles">Smaller bundles<a aria-hidden="true" href="#smaller-bundles">#</a></h3>
<p>SWC has enhanced its dead code elimination (DCE) capabilities in the current version, which combined with Rspack's powerful <a href="/guide/optimization/tree-shaking">tree shaking</a> functionality, enables Rspack 1.4 to generate smaller bundles.</p>
<p>We tested this using <code>react-router</code> as an example: by importing only part of its exports in the source code and then comparing the build outputs from different bundlers, we found that Rspack generates the smallest bundles.</p>
<pre><code meta="">

console.log(BrowserRouter, Routes, Route);
</code></pre>
<p>The output bundle sizes by different bundlers are as follows:</p>
<table>
<thead>
<tr>
<th>Bundler</th>
<th>Minified Size</th>
<th>Min+Gzipped Size</th>
</tr>
</thead>
<tbody>
<tr>
<td>Rspack (Rsbuild)</td>
<td><strong>36.35 kB</strong></td>
<td><strong>13.26 kB</strong></td>
</tr>
<tr>
<td>webpack</td>
<td>36.96 kB</td>
<td>13.37 kB</td>
</tr>
<tr>
<td>Vite</td>
<td>42.67 kB</td>
<td>15.67 kB</td>
</tr>
<tr>
<td>Rolldown</td>
<td>42.74 kB</td>
<td>15.17 kB</td>
</tr>
<tr>
<td>Rolldown Vite</td>
<td>43.42 kB</td>
<td>15.46 kB</td>
</tr>
<tr>
<td>Farm</td>
<td>43.42 kB</td>
<td>15.63 kB</td>
</tr>
<tr>
<td>Parcel</td>
<td>44.62 kB</td>
<td>16.07 kB</td>
</tr>
<tr>
<td>esbuild</td>
<td>46.12 kB</td>
<td>16.63 kB</td>
</tr>
<tr>
<td>Bun</td>
<td>57.73 kB</td>
<td>20.8 kB</td>
</tr>
</tbody>
</table>
<blockquote>
<p>Data from <a href="https://github.com/chenjiahan/react-router-tree-shaking-compare" target="_blank" rel="noopener noreferrer">react-router-tree-shaking-compare</a>.</p>
</blockquote>
<h3 id="incremental-build-by-default">Incremental build by default<a aria-hidden="true" href="#incremental-build-by-default">#</a></h3>
<p>After extensive optimization, Rspack's incremental build has become stable. In Rspack 1.4, we've enabled incremental build for all phases by default, which significantly speeds up rebuilds - HMR performance typically improves by <strong>30%-40%</strong>, depending on the project.</p>
<p>Here is a performance comparison from one user after enabling incremental build:</p>

<p>If you need to revert to the previous behavior, you can set <a href="/config/experiments#experimentsincremental">experiments.incremental</a> to <code>&#39;safe&#39;</code>. However, we recommend that most projects use the new default configuration to achieve optimal performance.</p>
<pre><code meta="">export default {
  experiments: {
    // Revert to previous behavior
    incremental: 'safe',
  },
};
</code></pre>
<h3 id="new-csschunkingplugin">New CssChunkingPlugin<a aria-hidden="true" href="#new-csschunkingplugin">#</a></h3>
<p>Rspack 1.4 introduces an experimental <a href="/plugins/rspack/css-chunking-plugin">CssChunkingPlugin</a> specifically designed for handling CSS code splitting. This plugin ensures that styles are loaded in the same order as they are imported in the source code, preventing UI issues caused by incorrect CSS loading order.</p>
<pre><code meta="">

export default {
  plugins: [
    new rspack.experiments.CssChunkingPlugin({
      // ...options
    }),
  ],
};
</code></pre>
<p>Once <code>CssChunkingPlugin</code> is enabled, CSS code splitting will be handled entirely by this plugin, and the <code>optimization.splitChunks</code> configuration will no longer affect CSS modules. You can check the <a href="/plugins/rspack/css-chunking-plugin">documentation</a> for more details.</p>
<blockquote>
<p>This plugin is inspired by Next.js's <a href="https://nextjs.org/docs/app/api-reference/config/next-config-js/cssChunking" target="_blank" rel="noopener noreferrer">CSS Chunking</a> feature. Thanks to the Next.js team for their innovation in this area.</p>
</blockquote>
<h3 id="enhanced-lazy-compilation">Enhanced lazy compilation<a aria-hidden="true" href="#enhanced-lazy-compilation">#</a></h3>
<p>Rspack now supports enabling lazy compilation with <code>MultiCompiler</code>, which means that when you use multiple Rspack configurations in a single build, you can independently configure the <a href="/config/experiments#experimentslazycompilation">lazyCompilation options</a> for each compiler instance.</p>
<pre><code meta="">export default [
  {
    target: 'web',
    experiments: {
      // enable lazy compilation for client
      lazyCompilation: true,
    },
  },
  {
    target: 'node',
    experiments: {
      // disable lazy compilation for server
      lazyCompilation: false,
    },
  },
];
</code></pre>
<h3 id="custom-input-file-system">Custom input file system<a aria-hidden="true" href="#custom-input-file-system">#</a></h3>
<p>Rspack now allows you to customize <code>compiler.inputFileSystem</code> (the compiler's input file system). This feature can be enabled by configuring <a href="/config/experiments#experimentsuseinputfilesystem">experiments.useInputFileSystem</a>. Typical use cases include:</p>
<ul>
<li>Using <a href="https://github.com/streamich/memfs" target="_blank" rel="noopener noreferrer">memfs</a> instead of the default input file system in browsers.</li>
<li>Working with the <a href="https://www.npmjs.com/package/webpack-virtual-modules" target="_blank" rel="noopener noreferrer">webpack-virtual-modules plugin</a> to support virtual modules.</li>
</ul>
<pre><code meta="">

export default {
  entry: './virtualEntry.js',
  plugins: [
    new VirtualModulesPlugin({
      'virtualEntry.js': `console.log('virtual entry')`,
    }),
  ],
  experiments: {
    useInputFileSystem: [/virtualEntry\.js$/],
  },
};
</code></pre>
<p>Since the custom <code>inputFileSystem</code> is implemented in JavaScript, it may lead to performance degradation. To mitigate this issue, <code>useInputFileSystem</code> allows you to pass an array of regular expressions to filter which files need to be read from the custom <code>inputFileSystem</code>, which avoids performance overhead caused by replacing the native file system.</p>
<p>In the future, we also plan to add built-in virtual module support in Rspack to provide better performance and user experience.</p>
<blockquote>
<p>For detailed usage, see the <a href="/config/experiments#experimentsuseinputfilesystem">documentation</a>.</p>
</blockquote>
<h3 id="performance-analysis-tool">Performance analysis tool<a aria-hidden="true" href="#performance-analysis-tool">#</a></h3>
<p>Rspack 1.4 introduces more precise tracing capabilities, which can be used for performance analysis based on <a href="https://perfetto.dev/" target="_blank" rel="noopener noreferrer">perfetto</a> to quickly identify build performance bottlenecks.</p>
<p>You can enable tracing through the <code>RSPACK_PROFILE</code> environment variable:</p>
<pre><code>RSPACK_PROFILE=OVERVIEW rspack build
</code></pre>
<p>The generated <code>rspack.pftrace</code> file can be visualized and analyzed at <a href="https://ui.perfetto.dev/" target="_blank" rel="noopener noreferrer">ui.perfetto.dev</a>:</p>

<blockquote>
<p>For more detailed usage, see the <a href="/contribute/development/tracing">Tracing documentation</a>.</p>
</blockquote>
<h3 id="dependency-upgrades">Dependency upgrades<a aria-hidden="true" href="#dependency-upgrades">#</a></h3>
<p>In Rspack 1.4, we have upgraded several major dependencies, including:</p>
<ul>
<li>Rspack now uses <a href="https://zod.dev/v4" target="_blank" rel="noopener noreferrer">Zod v4</a> for configuration validation.</li>
<li><code>create-rspack</code> now provides <a href="https://biomejs.dev/blog/biome-v2/" target="_blank" rel="noopener noreferrer">Biome v2</a> as an optional linter and formatter.</li>
</ul>
<h2 id="rstack-progress">Rstack progress<a aria-hidden="true" href="#rstack-progress">#</a></h2>
<p><a href="/guide/start/ecosystem#rstack">Rstack</a> is a unified JavaScript toolchain centered on Rspack, with high performance and consistent architecture.</p>
<h3 id="rsbuild-14">Rsbuild 1.4<a aria-hidden="true" href="#rsbuild-14">#</a></h3>
<p>Rsbuild 1.4 has been released alongside Rspack 1.4, with notable features including:</p>
<h4 id="chrome-devtools-integration">Chrome DevTools integration<a aria-hidden="true" href="#chrome-devtools-integration">#</a></h4>
<p>We've introduced a new <a href="https://github.com/rstackjs/rsbuild-plugin-devtools-json" target="_blank" rel="noopener noreferrer">rsbuild-plugin-devtools-json</a> plugin, which enables seamless integration with Chrome DevTools' new <a href="https://chromium.googlesource.com/devtools/devtools-frontend/+/main/docs/ecosystem/automatic_workspace_folders.md" target="_blank" rel="noopener noreferrer">Automatic Workspace Folders</a> feature. This means you can directly edit and debug your source code in DevTools and save changes to your local file system.</p>

<h4 id="improved-query-parameters">Improved query parameters<a aria-hidden="true" href="#improved-query-parameters">#</a></h4>
<p>Rsbuild now has built-in support for <code>.js?raw</code> query parameters, allowing you to import the raw content of JavaScript, TypeScript, and JSX files as text. This is very useful in scenarios where you need to process code as strings (such as displaying code examples).</p>
<pre><code>



console.log(rawJs); // Raw content of JS file
console.log(rawTs); // Raw content of TS file
console.log(rawJsx); // Raw content of JSX file
</code></pre>
<h4 id="improved-browser-compatibility">Improved browser compatibility<a aria-hidden="true" href="#improved-browser-compatibility">#</a></h4>
<p>When you import JS files from other packages in a monorepo, Rsbuild now uses SWC to compile them by default, which helps avoid browser compatibility issues introduced by external dependencies.</p>
<p>As shown in the diagram below, suppose the app's build target is ES2016 and utils' build target is ES2021. When <code>app/src/index.js</code> imports <code>utils/dist/index.js</code>, SWC will now downgrade it to ES2016.</p>

<h3 id="rslib-010">Rslib 0.10<a aria-hidden="true" href="#rslib-010">#</a></h3>
<p>Rslib 0.10 has been released, with notable features including:</p>
<h4 id="esm-output-optimization">ESM output optimization<a aria-hidden="true" href="#esm-output-optimization">#</a></h4>
<p>Rslib now generates cleaner, more concise, and smaller ESM output by default.</p>

<h4 id="building-vue-ui-libraries">Building Vue UI libraries<a aria-hidden="true" href="#building-vue-ui-libraries">#</a></h4>
<p>By integrating the <a href="https://github.com/rstackjs/rsbuild-plugin-unplugin-vue" target="_blank" rel="noopener noreferrer">rsbuild-plugin-unplugin-vue</a> plugin, you can use Rslib to generate bundleless builds for Vue UI libraries.</p>
<pre><code meta="">


export default defineConfig({
  plugins: [pluginUnpluginVue()],
  lib: [
    {
      format: 'esm',
      bundle: false,
      output: {
        target: 'web',
      },
    },
  ],
});
</code></pre>
<h4 id="output-iife-format">Output IIFE format<a aria-hidden="true" href="#output-iife-format">#</a></h4>
<p>Rslib now supports generating <a href="https://rslib.rs/guide/basic/output-format#iife" target="_blank" rel="noopener noreferrer">IIFE</a> format output, wrapping the code in a function expression.</p>

<blockquote>
<p>See the <a href="https://rslib.rs/blog/introducing-rslib" target="_blank" rel="noopener noreferrer">blog</a> for more information about Rslib.</p>
</blockquote>
<h3 id="rspress-20-beta">Rspress 2.0 beta<a aria-hidden="true" href="#rspress-20-beta">#</a></h3>
<p>We are actively developing <a href="https://github.com/web-infra-dev/rspress" target="_blank" rel="noopener noreferrer">Rspress 2.0</a> and have released multiple beta versions. Currently, we have completed most of the code refactoring work and have integrated <a href="https://shiki.style/" target="_blank" rel="noopener noreferrer">Shiki</a> by default in Rspress 2.0 to provide more powerful code highlighting features.</p>
<p>Additionally, we are developing a brand new theme, with the preview shown below:</p>

<h3 id="rsdoctor-mcp">Rsdoctor MCP<a aria-hidden="true" href="#rsdoctor-mcp">#</a></h3>
<p>Rsdoctor has introduced <a href="https://rsdoctor.rs/guide/start/mcp" target="_blank" rel="noopener noreferrer">@rsdoctor/mcp-server</a>, which combines LLMs to help you better analyze build data. It can access Rsdoctor's local build analysis data and provide intelligent analysis and optimization suggestions.</p>
<p>Rsdoctor MCP provides bundle analysis, dependency analysis, bundle optimization suggestions, and build optimization suggestions. It can analyze bundle size composition, dependency relationships, and duplicate dependencies, while providing targeted optimization suggestions for bundle size optimization, code splitting, and build performance.</p>

<h3 id="rstest-released">Rstest released<a aria-hidden="true" href="#rstest-released">#</a></h3>
<p><a href="https://github.com/web-infra-dev/rstest" target="_blank" rel="noopener noreferrer">Rstest</a> is a brand-new testing framework built on Rspack that provides comprehensive, first-class support for the Rspack ecosystem. It integrates seamlessly into existing Rspack projects and offers Jest-compatible APIs.</p>
<p>This month, we released Rstest v0.0.3, which provides initial support for Node.js and UI component testing, and has been adopted in our repositories like Rsbuild.</p>

<blockquote>
<p>Rstest is currently in its early stages. We recommend staying tuned as we continue to enhance its testing capabilities to provide a more complete solution.</p>
</blockquote>
<h2 id="ecosystem">Ecosystem<a aria-hidden="true" href="#ecosystem">#</a></h2>
<h3 id="next-rspack">next-rspack<a aria-hidden="true" href="#next-rspack">#</a></h3>
<p>Since <a href="/blog/rspack-next-partner">Rspack joined the Next.js ecosystem</a>, our primary goal has been to improve the stability and test coverage of next-rspack.</p>
<p>In the latest version, next-rspack has been largely completed, with test coverage reaching:</p>
<ul>
<li>Production builds <strong>99.4%</strong></li>
<li>Development builds <strong>98.4%</strong></li>
</ul>
<p>Moving forward, we plan to continue pushing test coverage to 100% and further optimize the performance of next-rspack.</p>

<h3 id="kmi">Kmi<a aria-hidden="true" href="#kmi">#</a></h3>
<p><a href="https://github.com/kmijs/kmi" target="_blank" rel="noopener noreferrer">Kmi</a> is a framework based on Umi and Rspack. By integrating Rspack as the bundler, Kmi delivers build performance improvements several times faster than the webpack version.</p>
<p>For developers currently using Umi, Kmi provides a progressive migration path that allows them to enjoy the performance benefits of Rspack while maintaining project stability.</p>
<p>For more information, see the <a href="https://github.com/kmijs/kmi" target="_blank" rel="noopener noreferrer">Kmi repository</a>.</p>
<h2 id="upgrade-guide">Upgrade guide<a aria-hidden="true" href="#upgrade-guide">#</a></h2>
<h3 id="upgrade-swc-plugins">Upgrade SWC plugins<a aria-hidden="true" href="#upgrade-swc-plugins">#</a></h3>
<p>If your project uses SWC Wasm plugins (such as <code>@swc/plugin-emotion</code>), you need to upgrade the plugins to a version compatible with <code>swc_core@29</code>, otherwise it may cause build errors due to version incompatibility.</p>
<blockquote>
<p>For more details, see <a href="/errors/swc-plugin-version">FAQ - SWC plugin version mismatch</a>.</p>
</blockquote>
<h3 id="lazy-compilation-middleware">Lazy compilation middleware<a aria-hidden="true" href="#lazy-compilation-middleware">#</a></h3>
<p>The lazy compilation middleware has changed its way of accessing the <a href="/config/experiments#experimentslazycompilation">lazyCompilation</a> option. Now, the middleware can automatically read the <code>lazyCompilation</code> option from the compiler instance, so you no longer need to manually pass in the <code>lazyCompilation</code> option.</p>
<pre><code>


const compiler = rspack([
  // ...multiple configs
]);

// no longer need to pass options to the middleware
const middleware = experiments.lazyCompilationMiddleware(compiler);

const server = new RspackDevServer(
  {
    setupMiddlewares: (other) =&gt; [middleware, ...other],
  },
  compiler,
);
</code></pre>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rspack joins the Next.js ecosystem]]></title>
            <link>https://rspack.rs/blog/rspack-next-partner</link>
            <guid>/blog/rspack-next-partner</guid>
            <pubDate>Thu, 10 Apr 2025 10:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>April 10, 2025</em></p>
<h1 id="rspack-joins-the-nextjs-ecosystem">Rspack joins the Next.js ecosystem<a aria-hidden="true" href="#rspack-joins-the-nextjs-ecosystem">#</a></h1>
<p>One of Rspack's primary goals is to seamlessly integrate with webpack-based projects or frameworks, providing an enhanced development experience with minimal migration costs.</p>
<p>In the JavaScript ecosystem, <a href="https://nextjs.org/" target="_blank" rel="noopener noreferrer">Next.js</a> has one of the most advanced build systems, with deeply customized webpack configurations and a rich plugin ecosystem. This made it an ideal candidate for testing and proving Rspack’s compatibility and robustness. Integrating Rspack into Next.js demonstrates Rspack's applicability in complex projects and provides Next.js users with an alternative solution to improve developer experience.</p>
<h2 id="rspack-comes-to-nextjs">Rspack comes to Next.js<a aria-hidden="true" href="#rspack-comes-to-nextjs">#</a></h2>
<p>Today, we’re excited to introduce <a href="https://www.npmjs.com/package/next-rspack" target="_blank" rel="noopener noreferrer">next-rspack</a>, a community-driven plugin bringing direct Rspack support to Next.js. This integration offers a fast, webpack-compatible alternative for teams not yet ready to adopt Turbopack.</p>
<blockquote>
<p>Get started today by visiting our <a href="/guide/tech/next">documentation</a> or checking out the official <a href="https://github.com/vercel/next.js/tree/canary/examples/with-rspack" target="_blank" rel="noopener noreferrer">Next.js example</a>.</p>
</blockquote>
<p>Before landing this support, we explored integration possibilities by creating <a href="https://github.com/ScriptedAlchemy/rsnext/tree/rspack" target="_blank" rel="noopener noreferrer">rsnext</a>, a fork of Next.js designed to prototype a near drop-in solution. This early fork played a valuable role in validating feasibility and discovering edge cases. Also, it made us realize that while Rspack’s high compatibility with webpack gave us a head start, achieving stable integration still required significant effort and collaboration.</p>
<h2 id="partnering-with-vercel-on-shared-foundations">Partnering with Vercel on shared foundations<a aria-hidden="true" href="#partnering-with-vercel-on-shared-foundations">#</a></h2>
<p>The launch of next-rspack is just one aspect of our broader collaboration with Vercel. This partnership extends beyond Next.js integration, as both teams focus on improving shared foundational technologies such as <a href="https://swc.rs/" target="_blank" rel="noopener noreferrer">SWC</a> and <a href="https://lightningcss.dev/" target="_blank" rel="noopener noreferrer">Lightning CSS</a>—widely adopted tools across the JavaScript ecosystem.</p>
<p>By working together to enhance these core components, we're laying a stronger foundation for better developer experience, performance, and reliability. These efforts benefit not only Rspack and Next.js, but also help uplift the broader JavaScript ecosystem. A rising tide lifts all boats.</p>
<p>To ensure ongoing reliability, next-rspack is now integrated into Next.js’s continuous integration pipeline, proactively catching regressions and maintaining compatibility. Although still experimental, it currently passes around 96% of integration tests, giving us the confidence to publicly release this integration. You can track the latest status with <a href="https://www.arewerspackyet.com/" target="_blank" rel="noopener noreferrer">arewerspackyet</a> and following <a href="https://x.com/rspack_dev" target="_blank" rel="noopener noreferrer">our twitter</a> for latest progress about next-rspack.</p>
<p>For teams not yet ready to adopt Turbopack, next-rspack offers a solid, fast alternative with excellent compatibility and straightforward setup.</p>
<p>We deeply appreciate Vercel’s collaboration and shared commitment to improving the tools that developers rely on every day. We’ll continue working together to refine this integration and support the future of modern JavaScript development.</p>
<h2 id="performance-insights">Performance insights<a aria-hidden="true" href="#performance-insights">#</a></h2>
<h3 id="app-router-users">App router users<a aria-hidden="true" href="#app-router-users">#</a></h3>
<p>Currently, the App Router implementation with <code>next-rspack</code> is <strong>slower than Turbopack</strong>, and may even be slower than webpack. This is due to some <strong>JavaScript plugins</strong> that cause heavy Rust-JavaScript communication overhead.</p>
<p>We have <strong>experimentally ported the theses plugins to Rust</strong>, which dramatically improved performance—almost on par with Turbopack. And we are exploring how to address the long-term maintenance challenges that come with deep integration.</p>
<h3 id="page-router-users">Page router users<a aria-hidden="true" href="#page-router-users">#</a></h3>
<p>The situation is much more promising:</p>
<ul>
<li><strong>Development Mode</strong>: 2x faster than webpack</li>
<li><strong>Production Mode</strong>: 1.5x faster than webpack</li>
</ul>
<p>Users deeply integrated into the webpack ecosystem will find migration easier.</p>
<p>There're some known bottlenecks which limit further performance improvement(like huge Rust-JavaScript communication overhead, slower <a href="https://nextjs.org/docs/pages/api-reference/config/next-config-js/output#how-it-works" target="_blank" rel="noopener noreferrer">output file tracing</a> implementation) which can be solved in the future, with expected improvements, we foresee:</p>
<ul>
<li><strong>5x faster builds and HMR in development</strong></li>
<li><strong>3x faster production builds</strong></li>
</ul>
<h2 id="frequently-asked-questions">Frequently asked questions<a aria-hidden="true" href="#frequently-asked-questions">#</a></h2>
<h3 id="how-will-it-remain-supported">How will it remain supported?<a aria-hidden="true" href="#how-will-it-remain-supported">#</a></h3>
<p>next-rspack is already integrated into Next.js’s CI pipeline, helping us catch regressions early and keep compatibility high. Support will evolve alongside both Next.js and Rspack, with ongoing collaboration between both teams and the open source community.</p>
<h3 id="who-maintains-it">Who maintains it?<a aria-hidden="true" href="#who-maintains-it">#</a></h3>
<p>next-rspack is a community plugin, but its development and integration rely on close collaboration between the Rspack and Vercel teams to ensure continued support and progress.</p>
<h3 id="does-this-have-any-impact-on-turbopack-is-vercel-adopting-rspack">Does this have any impact on Turbopack? is Vercel adopting Rspack?<a aria-hidden="true" href="#does-this-have-any-impact-on-turbopack-is-vercel-adopting-rspack">#</a></h3>
<p>Rspack doesn't replace Turbopack. It's an alternative solution for those with extensive webpack configurations who are not ready to migrate to Turbopack.</p>
<h3 id="what-are-known-issues">What are known issues?<a aria-hidden="true" href="#what-are-known-issues">#</a></h3>
<p>As of now, next-rspack passes around 96% of integration tests, and progress can be monitored on <a href="https://www.arewerspackyet.com/" target="_blank" rel="noopener noreferrer">arewerspackyet</a>.</p>
<ul>
<li>Some edge cases and advanced features may still require workarounds or additional support. Let us know how it went in the <a href="https://github.com/vercel/next.js/discussions/77800" target="_blank" rel="noopener noreferrer">feedback discussion</a>, even when you don't run into problems.</li>
<li>Due to the current plugin implementation, the performance of the App Router is still suboptimal and there's still plenty of room for performance improvement.</li>
<li>Since Rspack is not 100% compatible with webpack's API, some of your webpack plugins may not work smoothly on Rspack. Let us know if you have compatibility problems.</li>
</ul>
<h3 id="how-can-you-help">How can you help?<a aria-hidden="true" href="#how-can-you-help">#</a></h3>
<p>Try out next-rspack, report issues, contribute code or docs, and join the community discussions. Your feedback and contribution is valuable.</p>
<h2 id="future-plans">Future plans<a aria-hidden="true" href="#future-plans">#</a></h2>
<ul>
<li><strong>Increase Test Coverage</strong>: We aim to raise our test coverage from the current 96% to nearly 100% in the next quarter.</li>
<li><strong>Enhance Performance</strong>: We'll explore deeper integration with Next.js through native plugins to improve build performance.</li>
<li><strong>Iterate Based on User Feedback</strong>: Continue supporting more community plugins from the Next.js ecosystem.</li>
<li><strong>Improve Integration Workflow</strong>: Establish a more robust CI/CD pipeline between Rspack and Next.js to ensure the stability and reliability of next-rspack support.</li>
<li><strong>Better RSC Support</strong>: Turbopack’s unified module graph unlocks faster and simpler RSC implementation. Rspack will deliver a similar API to bring first-class, high-performance RSC support to the ecosystem.</li>
<li><strong>Module Federation Support</strong>: We are discussing with Next.js team about improved support of Module Federation.</li>
</ul>
<p>Through 2024, stability and artifact integrity were a primary focus for Rspack. In 2025 we are focusing more on speed opportunities and broad ecosystem.</p>
<p>Stay tuned—we’re just getting started.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.3]]></title>
            <link>https://rspack.rs/blog/announcing-1-3</link>
            <guid>/blog/announcing-1-3</guid>
            <pubDate>Fri, 28 Mar 2025 16:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>March 28, 2025</em></p>
<h1 id="announcing-rspack-13">Announcing Rspack 1.3<a aria-hidden="true" href="#announcing-rspack-13">#</a></h1>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-3.png" alt="Rspack 1.3"></img></p>
<hr></hr>
<p>Rspack 1.3 has been released!</p>
<p>Notable changes:</p>
<ul>
<li>New features
<ul>
<li><a href="#circular-dependency-detection">Circular dependency detection</a></li>
<li><a href="#build-http-imports">Build HTTP imports</a></li>
<li><a href="#lazy-compilation-improvements">Lazy compilation improvements</a></li>
<li><a href="#amd-supports">AMD supports</a></li>
</ul>
</li>
<li>Performance improvements
<ul>
<li><a href="#code-splitting-25-faster">Code splitting 25% faster</a></li>
<li><a href="#bundle-size-optimization">Bundle size optimization</a></li>
<li><a href="#memory-improvements">Memory improvements</a></li>
</ul>
</li>
<li>Rstack updates
<ul>
<li><a href="#rsdoctor-10">Rsdoctor 1.0</a></li>
<li><a href="#rsbuild-13">Rsbuild 1.3</a></li>
<li><a href="#rslib-06">Rslib 0.6</a></li>
<li><a href="#rspress-and-rstest">Rspress and Rstest</a></li>
</ul>
</li>
<li>Ecosystem
<ul>
<li><a href="#rspeedy-for-lynx">Rspeedy for Lynx</a></li>
<li><a href="#repack-5">Re.Pack 5</a></li>
<li><a href="#react-router-v7-support">React Router v7 support</a></li>
</ul>
</li>
<li>Upgrade guide
<ul>
<li><a href="#module-subtypes-changed">Module subtypes changed</a></li>
<li><a href="#upgrade-swc-plugins">Upgrade SWC plugins</a></li>
</ul>
</li>
</ul>
<h2 id="new-features">New features<a aria-hidden="true" href="#new-features">#</a></h2>
<h3 id="circular-dependency-detection">Circular dependency detection<a aria-hidden="true" href="#circular-dependency-detection">#</a></h3>
<p>Rspack 1.3 introduces a built-in plugin <a href="/plugins/rspack/circular-dependency-rspack-plugin">CircularDependencyRspackPlugin</a> to detect circular dependencies between runtime modules.</p>
<p>This plugin is implemented in Rust and deeply integrated with Rspack's module graph, avoiding expensive data copying and serialization overhead. It detects all circular dependencies by performing a single traversal of the module graph for each entry point, rather than checking each module independently, resulting in lower performance overhead.</p>
<pre><code meta="">

export default {
  plugins: [new rspack.CircularDependencyRspackPlugin()],
};
</code></pre>
<blockquote>
<p>Special thanks to <a href="https://github.com/faultyserver" target="_blank" rel="noopener noreferrer">@faultyserver</a> for contributing this plugin ❤️</p>
</blockquote>
<h3 id="build-http-imports">Build HTTP imports<a aria-hidden="true" href="#build-http-imports">#</a></h3>
<p>In previous versions, you could import HTTP/HTTPS resources by using <a href="/config/externals#externalspresetsweb">externalsPresets.web</a> or <a href="/config/externals#externalspresetswebasync">externalsPresets.webAsync</a> options, which simply externals the these resources and let the browser (or other platform) to fetch them at runtime.</p>
<pre><code>
</code></pre>
<p>And the new <a href="/config/experiments#experimentsbuildhttp">experiments.buildHttp</a> option provides a new way to import HTTP/HTTPS resources, not fetch the resources at runtime, but download them to the local cache at build time and then bundle them into your output.</p>
<pre><code meta="">export default {
  experiments: {
    buildHttp: {
      allowedUris: ['https://esm.sh/'],
    },
  },
};
</code></pre>
<blockquote>
<p>See <a href="/config/experiments#experimentsbuildhttp">the docs</a> for more details.</p>
</blockquote>
<h3 id="lazy-compilation-improvements">Lazy compilation improvements<a aria-hidden="true" href="#lazy-compilation-improvements">#</a></h3>
<p>In previous versions, when <a href="/guide/features/lazy-compilation">lazy compilation</a> was enabled, Rspack would start a separate server to handle lazy compilation-related requests. This led to several issues, such as the need for two servers during development, and the lazy compilation server not being able to share proxy and CORS configurations with the default dev server.</p>
<p>Rspack 1.3 provides new Express-style middleware for integrating lazy compilation that addresses these issues.</p>
<ul>
<li>If you are using <code>@rspack/cli</code> or Rsbuild, you can upgrade to the new middleware by simply updating the dependency version.</li>
<li>If you are using a custom development server, you will need to integrate this middleware to support lazy compilation.</li>
</ul>
<p>Here's an example of how to use the lazy compilation middleware:</p>
<pre><code>



const compiler = rspack(config);
const middleware = rspack.experiments.lazyCompilationMiddleware(
  compiler,
  config.experiments.lazyCompilation,
);

const server = new DevServer(
  {
    setupMiddlewares(other) {
      return [middleware, ...other];
    },
  },
  compiler,
);
</code></pre>
<h3 id="amd-supports">AMD supports<a aria-hidden="true" href="#amd-supports">#</a></h3>
<p>Rspack now allows you to enable AMD module support by using the <a href="/config/other-options#amd">amd</a> option.</p>
<p>Notably, Rspack differs from webpack in that the parsing of AMD modules is disabled by default (webpack enables it by default). This feature is only for compatibility with certain legacy AMD npm dependencies. We recommend prioritizing ES Module dependencies for better Rspack optimization and to boost ES Module adoption.</p>
<p>Add the <code>amd</code> option to enable support:</p>
<pre><code meta="">export default {
  amd: {
    // ...
  },
};
</code></pre>
<blockquote>
<p>Special thanks to <a href="https://github.com/nilptr" target="_blank" rel="noopener noreferrer">@nilptr</a> for contributing this plugin ❤️</p>
</blockquote>
<h2 id="performance-improvements">Performance improvements<a aria-hidden="true" href="#performance-improvements">#</a></h2>
<h3 id="code-splitting-25-faster">Code splitting 25% faster<a aria-hidden="true" href="#code-splitting-25-faster">#</a></h3>
<p>In Rspack 1.2, we introduced the <a href="/config/experiments#experimentsparallelcodesplitting">experiments.parallelCodeSplitting</a> option to enable the new code splitting algorithm.</p>
<p>Starting from Rspack 1.3, this option is enabled by default, resulting in a <strong>25%</strong> performance boost for code splitting.</p>
<h3 id="bundle-size-optimization">Bundle size optimization<a aria-hidden="true" href="#bundle-size-optimization">#</a></h3>
<p>Rspack 1.3 introduces full support for the <a href="/config/output#outputenvironment">output.environment</a> option, which allows you to specify which ECMAScript features can be used in the runtime code generated by Rspack, and to generate shorter and more modern runtime code.</p>
<p>By default, Rspack parses the <a href="/config/target">target</a> option and automatically sets the values of the <code>output.environment</code> sub-options based on <code>browserslist</code> to determine which ECMAScript features are supported by the target environment, thus outputting the optimized code.</p>
<p>For example, if Rspack detects that the target environment supports arrow functions, it sets <code>output.environment.arrowFunction</code> to <code>true</code> and using arrow function syntax in the generated code.</p>
<pre><code>// before
- __webpack_require__.d = function(exports, definition) {

// after
+ __webpack_require__.d = (exports, definition) =&gt; {
</code></pre>
<p>By utilizing modern JavaScript features supported by the target environment, Rspack can output smaller runtime code. In our performance testing on a real large-scale project, this optimization reduced the bundle size by approximately 500KB (before gzip compression).</p>
<h3 id="memory-improvements">Memory improvements<a aria-hidden="true" href="#memory-improvements">#</a></h3>
<p>Rspack now defaults to using <a href="https://github.com/microsoft/mimalloc" target="_blank" rel="noopener noreferrer">mimalloc</a> v3 on macOS. This mitigates some memory consumption issue on macOS during rebuilding. According to some community and internal projects, this would lift the RSS for rebuilding, based on the size of each project, varying from <strong>10% to 85%</strong>.</p>
<p>Rspack 1.3 also implemented an internal mechanism to clean the outdated cache: <code>maxGenerations</code>. This controls how many compilations would cache survive if it's not being used by the compiler. Rspack sets the default to <code>1</code>. This means that the cache will be purged if it's not being used in the next compilation.</p>

<h2 id="rstack-updates">Rstack updates<a aria-hidden="true" href="#rstack-updates">#</a></h2>

<h3 id="rsdoctor-10">Rsdoctor 1.0<a aria-hidden="true" href="#rsdoctor-10">#</a></h3>
<p>After a year of development and testing, we are proud to introduce <a href="https://github.com/web-infra-dev/rsdoctor" target="_blank" rel="noopener noreferrer">Rsdoctor 1.0</a> — a build analyzer tailored for the Rspack ecosystem and fully compatible with the webpack ecosystem.</p>
<p>Rsdoctor is committed to being a one-stop, intelligent build analyzer that makes the build process transparent, predictable, and optimizable through visualization and smart analysis, helping development teams precisely identify bottlenecks, optimize performance, and improve engineering quality.</p>
<p>Rsdoctor 1.0 introduces significant enhancements:</p>
<ul>
<li>A completely redesigned UI that delivers more intuitive and efficient information visualization.</li>
<li>Rewrote data processing logic using Rust, achieving 20%+ improvement in analysis speed.</li>
<li>New module search capabilities for analyzing dependencies and module sizes.</li>
</ul>
<blockquote>
<p>Read the <a href="https://rsdoctor.rs/zh/blog/release/release-note-1_0" target="_blank" rel="noopener noreferrer">Rsdoctor 1.0 release blog</a> for more.</p>
</blockquote>
<h3 id="rsbuild-13">Rsbuild 1.3<a aria-hidden="true" href="#rsbuild-13">#</a></h3>
<p>Rsbuild 1.3 has been released alongside Rspack 1.3, notable features including:</p>
<ul>
<li>Support importing compiled CSS files as strings by using the <a href="https://rsbuild.rs/guide/basic/css-usage#inline" target="_blank" rel="noopener noreferrer">?inline</a> query parameter:</li>
</ul>
<pre><code>

console.log(inlineCss); // Output the compiled CSS file content
</code></pre>
<ul>
<li>Support importing raw CSS files and static assets as strings by using the <a href="https://rsbuild.rs/guide/basic/css-usage#raw" target="_blank" rel="noopener noreferrer">?raw</a> query parameter:</li>
</ul>
<pre><code>


console.log(rawSvg); // Output the raw SVG file content
console.log(rawCss); // Output the raw CSS file content
</code></pre>
<h3 id="rslib-06">Rslib 0.6<a aria-hidden="true" href="#rslib-06">#</a></h3>
<p>Rslib 0.6 brings the following notable updates:</p>
<ul>
<li><strong>Improved CJS output</strong>: Rslib's CJS output can now be statically analyzed, allowing Node.js ESM modules to use named imports to reference exports from CJS output.</li>
<li><strong>Type error optimization</strong>: When type errors occur, Rslib now prints the full context and code frame to the terminal, making it easier to fix type issues.</li>
</ul>
<p>This release also adds support for YAML and TOML. See <a href="https://github.com/web-infra-dev/rslib/releases/tag/v0.6.0" target="_blank" rel="noopener noreferrer">Rslib 0.6</a> for more details.</p>
<h3 id="rspress-and-rstest">Rspress and Rstest<a aria-hidden="true" href="#rspress-and-rstest">#</a></h3>
<p>We are also working on:</p>
<ul>
<li><strong>Rspress 2.0</strong>: A fully upgraded static site generator with richer features and better performance.</li>
<li><strong>Rstest</strong>: A testing framework powered by Rspack. It delivers comprehensive, first-class support for the Rspack ecosystem, enabling seamless integration into existing Rspack-based projects.</li>
</ul>
<p>More information will be released soon, stay tuned 🌟</p>
<h2 id="ecosystem">Ecosystem<a aria-hidden="true" href="#ecosystem">#</a></h2>
<h3 id="rspeedy-for-lynx">Rspeedy for Lynx<a aria-hidden="true" href="#rspeedy-for-lynx">#</a></h3>
<p><a href="https://lynxjs.org/" target="_blank" rel="noopener noreferrer">Lynx</a> is a family of technologies empowering developers to use their existing web skills to create truly native UIs for both mobile and web from a single codebase. Lynx was originally developed by an engineering team of ByteDance, which continues to drive its development.</p>
<p>Lynx has built a modern toolchain called <a href="https://lynxjs.org/rspeedy/" target="_blank" rel="noopener noreferrer">Rspeedy</a> based on Rspack, Rsbuild, and Rsdoctor to enable fast builds. Lynx also features a speedy, versatile rendering engine and performance-driven dual-threaded UI programming.</p>
<p><img src="https://lf-lynx.tiktok-cdns.com/obj/lynx-artifacts-oss-sg/lynx-website/assets/blog/lynx-unlock-native-for-more.png" alt=""></img></p>
<blockquote>
<p>Read the <a href="https://lynxjs.org/blog/lynx-unlock-native-for-more.html" target="_blank" rel="noopener noreferrer">Introductory Blog of Lynx</a> for more.</p>
</blockquote>
<h3 id="repack-5">Re.Pack 5<a aria-hidden="true" href="#repack-5">#</a></h3>
<p><a href="https://github.com/callstack/repack" target="_blank" rel="noopener noreferrer">Re.Pack</a> is a build tool for building your React Native application.</p>
<p>Re.Pack 5 has been released, which brings unprecedented performance improvements through Rspack, proper microfrontends support through Module Federation 2, simplified configuration and more.</p>
<blockquote>
<p>Read the <a href="https://re-pack.dev/blog/repack-5-release" target="_blank" rel="noopener noreferrer">Re.Pack 5 release blog</a> for more.</p>
</blockquote>
<h3 id="react-router-v7-support">React Router v7 support<a aria-hidden="true" href="#react-router-v7-support">#</a></h3>
<p><a href="https://github.com/rstackjs/rsbuild-plugin-react-router" target="_blank" rel="noopener noreferrer">rsbuild-plugin-react-router</a> has been released, which is an Rsbuild plugin that provides seamless integration with React Router v7, supporting the following features:</p>
<ul>
<li>Filesystem routes</li>
<li>Server-side rendering</li>
<li>Experimental Module Federation support</li>
</ul>
<blockquote>
<p>See <a href="https://github.com/rstackjs/rsbuild-plugin-react-router" target="_blank" rel="noopener noreferrer">rsbuild-plugin-react-router repository</a> to try it out.</p>
</blockquote>
<h2 id="upgrade-guide">Upgrade guide<a aria-hidden="true" href="#upgrade-guide">#</a></h2>
<h3 id="module-types-changed">Module types changed<a aria-hidden="true" href="#module-types-changed">#</a></h3>
<p>The module types exported by Rspack have been refined with more accurate type definitions, which helps to align with webpack. Currently supported module subtypes include:</p>
<ul>
<li>NormalModule</li>
<li>ContextModule</li>
<li>ExternalModule</li>
<li>ConcatenatedModule</li>
</ul>
<p>You can now identify a module's specific type in two ways:</p>
<pre><code>// Method 1: Instance type checking
module instanceof NormalModule;

// Method 2: Constructor signature detection
module.constructor.name === &#39;NormalModule&#39;;
</code></pre>
<p>The new type definitions may cause type errors in existing JavaScript API code, such as:</p>
<pre><code>module.resource; // TypeScript Error: Property &#39;resource&#39; does not exist on type &#39;Module&#39;
</code></pre>
<p>To access the <code>resource</code> property, you now need to assert the module type using one of the following methods:</p>
<pre><code>// Solution 1: `in` operator type guard
if (&#39;resource&#39; in module) {
  console.log(module.resource);
}

// Solution 2: Instance type assertion
if (module instanceof NormalModule) {
  module.resource;
}
</code></pre>
<h3 id="upgrade-swc-plugins">Upgrade SWC plugins<a aria-hidden="true" href="#upgrade-swc-plugins">#</a></h3>
<p>In Rspack 1.3, the Rust crate <code>swc_core</code> has been upgraded to v16. Users of the SWC Wasm plugin need to ensure version consistency with <code>swc_core</code> being used, otherwise, it may lead to unforeseen issues.</p>
<p>For more details, see <a href="/errors/swc-plugin-version">FAQ - SWC plugin version mismatch</a>.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.2]]></title>
            <link>https://rspack.rs/blog/announcing-1-2</link>
            <guid>/blog/announcing-1-2</guid>
            <pubDate>Tue, 21 Jan 2025 16:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>January 21, 2025</em></p>
<h1 id="announcing-rspack-12">Announcing Rspack 1.2<a aria-hidden="true" href="#announcing-rspack-12">#</a></h1>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-2.png" alt="Rspack 1.2"></img></p>
<blockquote>
<p>Posted by <a href="https://github.com/jerrykingxyz" target="_blank" rel="noopener noreferrer">@jerrykingxyz</a>, <a href="https://github.com/chenjiahan" target="_blank" rel="noopener noreferrer">@chenjiahan</a>, <a href="https://github.com/JSerFeng" target="_blank" rel="noopener noreferrer">@JSerFeng</a>, <a href="https://github.com/ahabhgk" target="_blank" rel="noopener noreferrer">@ahabhgk</a></p>
</blockquote>
<hr></hr>
<p>Rspack v1.2 has been released!</p>
<p>Notable changes:</p>
<ul>
<li>New features
<ul>
<li><a href="#persistent-cache">Persistent cache</a>: An experimental feature that improves hot start performance by up to <strong>250%</strong>.</li>
<li><a href="#yarn-pnp">Yarn PnP</a></li>
</ul>
</li>
<li>Performance improvements
<ul>
<li><a href="#faster-code-splitting">Faster code splitting</a>: An experimental flag that significantly improve the code splitting performance.</li>
<li><a href="#watch-scope-change">Watch scope change</a></li>
<li><a href="#reduced-memory-usage">Reduced memory usage</a></li>
<li><a href="#smaller-minification-size">Smaller minification size</a></li>
<li><a href="#faster-side-effects-optimization">Faster side effects optimization</a></li>
</ul>
</li>
<li>Ecosystem
<ul>
<li><a href="#angular-support">Angular support</a></li>
<li><a href="#rsbuild-v1-2">Rsbuild v1.2</a></li>
</ul>
</li>
</ul>
<h2 id="new-features">New features<a aria-hidden="true" href="#new-features">#</a></h2>
<h3 id="persistent-cache">Persistent cache<a aria-hidden="true" href="#persistent-cache">#</a></h3>
<p>Rspack v1.2 introduced an experimental cache configuration that supports persistent caching, which can significantly improve hot startup speed.</p>
<pre><code meta="">export default {
  cache: true,
  experiments: {
    cache: {
      type: 'persistent',
    },
  },
};
</code></pre>
<p>When a build hits the cache, it can bring up to 250% performance improvement in real projects.</p>
<table>
<thead>
<tr>
<th>Project type</th>
<th>Number of modules</th>
<th>Normal dev</th>
<th>Cold dev</th>
<th>Hot dev</th>
</tr>
</thead>
<tbody>
<tr>
<td>Initial project</td>
<td>26</td>
<td>146 ms</td>
<td>149 ms (+2%)</td>
<td>134 ms (-8%)</td>
</tr>
<tr>
<td>Project with 10000 modules</td>
<td>10040</td>
<td>2.43 s</td>
<td>2.43 s (+0%)</td>
<td>1.16 s (-52%)</td>
</tr>
<tr>
<td>Project with Less files</td>
<td>1898</td>
<td>3.47 s</td>
<td>3.55 s (+2%)</td>
<td>0.92 s (-73%)</td>
</tr>
<tr>
<td>Large real project</td>
<td>45968</td>
<td>93.3 s</td>
<td>91.9 s (-1%)</td>
<td>26 s (-72%)</td>
</tr>
</tbody>
</table>
<p>Note that persistent cache is still in an experimental stage and currently only supports the make stage of the build process (including module resolution, transformation, etc.). We will continue to optimize it in the future to further improve cache performance and coverage.</p>
<p>If you encounter any issues while using persistent cache, please feel free to report them via GitHub Issues.</p>
<blockquote>
<p>See <a href="/config/experiments#experimentscache">experiments.cache</a> for more details.</p>
</blockquote>
<h3 id="yarn-pnp">Yarn PnP<a aria-hidden="true" href="#yarn-pnp">#</a></h3>
<p>Rspack has added support for <a href="https://yarnpkg.com/features/pnp" target="_blank" rel="noopener noreferrer">Yarn PnP</a>, which is enabled by default based on <code>process.versions.pnp</code> (that is, when the application is running in a Yarn PnP environment), and can also be forced to enable by configuring <code>resolve.pnp</code> to <code>true</code>.</p>
<pre><code meta="">export default {
  resolve: {
    pnp: true,
  },
};
</code></pre>
<p>Special thanks to <a href="https://x.com/arcanis" target="_blank" rel="noopener noreferrer">@arcanis</a>, the lead maintainer for Yarn, for implementing PnP resolution in the Rspack resolver.</p>
<blockquote>
<p>See <a href="/config/resolve#resolvepnp">resolve.pnp</a> for more details.</p>
</blockquote>
<h2 id="performance-improvements">Performance improvements<a aria-hidden="true" href="#performance-improvements">#</a></h2>
<h3 id="faster-code-splitting">Faster code splitting<a aria-hidden="true" href="#faster-code-splitting">#</a></h3>
<p>In previous versions of Rspack, the code splitting would take up a lot of time under HMR. In Rspack v1.2, we implemented a new code splitting algorithm that supports multithreading and more efficient incremental rebuilds. If your code base contains a lot of dynamic imports, and code splitting will take a lot of time. Enabling this new feature can significantly improve the performance of code splitting.</p>
<pre><code meta="">export default {
  experiments: {
    parallelCodeSplitting: true,
  },
};
</code></pre>
<blockquote>
<p>See <a href="/config/experiments#experimentsparallelcodesplitting">experiments.parallelCodeSplitting</a> for more details.</p>
</blockquote>
<h3 id="watch-scope-change">Watch scope change<a aria-hidden="true" href="#watch-scope-change">#</a></h3>
<p>Rspack v1.2 no longer watching the <code>node_modules</code> directory by default. This can greatly reduce the number of files to watch and improve performance.</p>
<p>According to our <a href="https://github.com/rstackjs/build-tools-performance" target="_blank" rel="noopener noreferrer">benchmark repo</a>, this change will:</p>
<ul>
<li>Reduce memory usage by 120MB</li>
<li>Increase dev startup speed by 40%</li>
<li>Increase HMR speed by 20~30%</li>
</ul>
<p>This change will not affect symlinked resources in monorepo, as symlinked resources are resolved to their real path by default.</p>
<p>If you prefer to keep the previous behavior, you can set:</p>
<pre><code meta="">export default {
  watchOptions: {
    ignored: [],
  },
};
</code></pre>
<blockquote>
<p>See <a href="/config/watch#watchoptionsignored">watchOptions.ignored</a> for more details.</p>
</blockquote>
<h3 id="reduced-memory-usage">Reduced memory usage<a aria-hidden="true" href="#reduced-memory-usage">#</a></h3>
<p>We have optimized the data structure used to store strings during the <a href="https://github.com/rstackjs/rspack-sources" target="_blank" rel="noopener noreferrer">rspack-sources</a> computation process. Throughout the computation, all string data points to the string heap memory of the root node, effectively avoiding the generation of new string allocations during the computation.</p>
<blockquote>
<p>See <a href="https://github.com/web-infra-dev/rspack/pull/8666" target="_blank" rel="noopener noreferrer">perf: reduce memory consumption of CachedSource</a> for more details.</p>
</blockquote>
<h3 id="smaller-minification-size">Smaller minification size<a aria-hidden="true" href="#smaller-minification-size">#</a></h3>
<p>Rspack v1.2 set default SWC minimizer <code>passes</code> to <code>2</code> to reduce bundle size by 1%-7%.</p>
<pre><code>new rspack.SwcJsMinimizerRspackPlugin({
  minimizerOptions: {
    compress: {
      // Defaults to 1 in previous versions
      passes: 2,
    },
  },
});
</code></pre>
<p><a href="https://swc.rs/docs/configuration/minification#jscminifycompress" target="_blank" rel="noopener noreferrer">passes</a> is the the maximum number of times to run compress. In some cases, more than one pass leads to further compressed code. Given Rspack's inherent speed, we've determined that using <code>2</code> passes by default strikes an optimal balance between build performance and bundle size.</p>
<blockquote>
<p>See <a href="https://github.com/web-infra-dev/rspack/pull/8853" target="_blank" rel="noopener noreferrer">feat: set default SWC minimizer passes to 2 to reduce bundle size</a> for more details.</p>
</blockquote>
<h3 id="faster-side-effects-optimization">Faster side effects optimization<a aria-hidden="true" href="#faster-side-effects-optimization">#</a></h3>
<p>The implementation of side effects optimization has been refactored to be simpler and more parallelism-friendly. It can take full advantage of parallelism to improve performance. In tested projects, there is typically a 2x-3x performance improvement at this stage.</p>
<blockquote>
<p>See <a href="https://github.com/web-infra-dev/rspack/pull/8781" target="_blank" rel="noopener noreferrer">perf: parallelize side effects optimization</a> for more details.</p>
</blockquote>
<h2 id="ecosystem">Ecosystem<a aria-hidden="true" href="#ecosystem">#</a></h2>
<h3 id="angular-support">Angular support<a aria-hidden="true" href="#angular-support">#</a></h3>
<p>Nx team core member <a href="https://github.com/Coly010" target="_blank" rel="noopener noreferrer">Colum Ferry</a> has brought complete Angular support to the Rspack ecosystem.</p>
<p>With the newly released <code>@ng-rsbuild/plugin-angular</code> and <code>@ng-rspack/build</code> packages, developers can now use Rspack or Rsbuild to build Angular applications, with faster build performance and module federation support.</p>
<p>Please visit <a href="https://github.com/nrwl/angular-rspack" target="_blank" rel="noopener noreferrer">Angular Rspack</a> for more information.</p>
<h3 id="rsbuild-v12">Rsbuild v1.2<a aria-hidden="true" href="#rsbuild-v12">#</a></h3>
<p>Rsbuild v1.2 has been released alongside Rspack v1.2, bringing several new features:</p>
<ul>
<li>Customize manifest file generation through <a href="https://rsbuild.rs/config/output/manifest#generate" target="_blank" rel="noopener noreferrer">output.manifest.generate</a>.</li>
<li>Specify files to retain in the dist directory using <a href="https://rsbuild.rs/config/output/clean-dist-path#keep" target="_blank" rel="noopener noreferrer">cleanDistPath.keep</a>.</li>
<li><a href="https://rsbuild.rs/plugins/list/plugin-assets-retry" target="_blank" rel="noopener noreferrer">@rsbuild/plugin-assets-retry</a> now generates smaller runtime code.</li>
</ul>
<blockquote>
<p>For more details, see <a href="https://github.com/web-infra-dev/rsbuild/releases/tag/v1.2.0" target="_blank" rel="noopener noreferrer">Rsbuild v1.2.0</a>.</p>
</blockquote>
<h2 id="upgrade-guide">Upgrade guide<a aria-hidden="true" href="#upgrade-guide">#</a></h2>
<h3 id="upgrade-swc-plugins">Upgrade SWC plugins<a aria-hidden="true" href="#upgrade-swc-plugins">#</a></h3>
<p>In Rspack v1.2, the Rust crate <code>swc_core</code> has been upgraded to <code>10.1.0</code>. Users of the SWC Wasm plugin need to ensure version consistency with <code>swc_core</code> being used, otherwise, it may lead to unforeseen issues.</p>
<p>For more details, see <a href="https://swc.rs/docs/plugin/selecting-swc-core" target="_blank" rel="noopener noreferrer">FAQ - SWC plugin version mismatch</a>.</p>
<h3 id="disable-warncasesensitivemodulesplugin-by-default">Disable WarnCaseSensitiveModulesPlugin by default<a aria-hidden="true" href="#disable-warncasesensitivemodulesplugin-by-default">#</a></h3>
<p>The <a href="/plugins/webpack/case-sensitive-plugin">WarnCaseSensitiveModulesPlugin</a> is used to check the paths of modules and issue warnings for modules that conflict when their paths are all in lowercase. Rspack used to enable it by default, but since it is only a "linter" plugin and it has additional performance overhead especially in development mode. So now it is disabled by default.</p>
<p>If you prefer to keep the previous behavior, you can set:</p>
<pre><code meta="">

export default {
  plugins: [new rspack.WarnCaseSensitiveModulesPlugin()],
};
</code></pre>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.1]]></title>
            <link>https://rspack.rs/blog/announcing-1-1</link>
            <guid>/blog/announcing-1-1</guid>
            <pubDate>Thu, 07 Nov 2024 16:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>November 7, 2024</em></p>
<h1 id="announcing-rspack-11">Announcing Rspack 1.1<a aria-hidden="true" href="#announcing-rspack-11">#</a></h1>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-1.png" alt="Rspack 1.1"></img></p>
<blockquote>
<p>Posted by <a href="https://github.com/LingyuCoder" target="_blank" rel="noopener noreferrer">@LingyuCoder</a>, <a href="https://github.com/ahabhgk" target="_blank" rel="noopener noreferrer">@ahabhgk</a>, <a href="https://github.com/GiveMe-A-Name" target="_blank" rel="noopener noreferrer">@GiveMe-A-Name</a>, <a href="https://github.com/9aoy" target="_blank" rel="noopener noreferrer">@9aoy</a>, <a href="https://github.com/chenjiahan" target="_blank" rel="noopener noreferrer">@chenjiahan</a></p>
</blockquote>
<hr></hr>
<p>Rspack v1.1 and Rsbuild v1.1 are out!</p>
<p>Notable changes:</p>
<ul>
<li>Performance improvements
<ul>
<li><a href="#better-scheduling-strategy">Better scheduling strategy</a>: Make Rspack <strong>10% faster</strong> than v1.0.</li>
<li><a href="#new-incremental-rebuild">New incremental rebuild</a>: Experimental feature that makes HMR <strong>up to 38% faster</strong>.</li>
</ul>
</li>
<li>New features
<ul>
<li><a href="#improved-html-plugin">Improved HTML Plugin</a>: Refactored the built-in HTML plugin with new features.</li>
<li><a href="#improved-jsdoc">Improved JSDoc</a>: Added JSDoc for all configuration options.</li>
</ul>
</li>
<li>Ecosystem
<ul>
<li><a href="#docusaurus-faster">Docusaurus Faster</a>: Use Rspack as the bundler for Docusaurus sites.</li>
<li><a href="#nuxt-rspack-builder">Nuxt Rspack Builder</a>: Experimental Rspack builder for Nuxt.</li>
</ul>
</li>
<li><a href="#rsbuild-v11">Rsbuild v1.1</a>: CLI shortcuts and new configurations.</li>
</ul>
<h2 id="performance-improvements">Performance improvements<a aria-hidden="true" href="#performance-improvements">#</a></h2>
<h3 id="better-scheduling-strategy">Better scheduling strategy<a aria-hidden="true" href="#better-scheduling-strategy">#</a></h3>
<p>According to our benchmarks, Rspack v1.1 is <strong>10% faster</strong> than v1.0.</p>

<p>A major optimization is that Rspack uses a better scheduling strategy inspired by <a href="https://thenewstack.io/using-rustlangs-async-tokio-runtime-for-cpu-bound-tasks/" target="_blank" rel="noopener noreferrer">Using Rustlang’s Async Tokio Runtime for CPU-Bound Tasks</a> and SWC optimization for better concurrency support, which allows better scheduling of async tasks.</p>
<h3 id="new-incremental-rebuild">New incremental rebuild<a aria-hidden="true" href="#new-incremental-rebuild">#</a></h3>
<p>In the early versions of Rspack 0.x, we implemented <a href="https://v0.rspack.rs/config/experiments#experimentsincrementalrebuild" target="_blank" rel="noopener noreferrer">experiments.incrementalRebuild</a>. As this feature gradually stabilized, we removed the experiments configuration and enabled it by default.</p>
<p>However, this feature only enabled incrementality for the <code>make</code> and <code>emitAssets</code> stages of the rebuild. For many projects, the loader in the <code>make</code> stage takes a lot of time. At that time, this feature had a relatively obvious performance improvement in rebuild for these projects. But there are still some projects that take a lot of time in stages other than <code>make</code>. Therefore, we optimized and expanded this feature and gradually introduced this feature into other stages, such as <code>buildChunkGraph</code>, <code>providedExports</code>, <code>moduleCodegen</code>, etc.</p>
<p>In Rspack v1.1, we introduced <a href="/config/experiments#experimentsincremental">experiments.incremental</a> as the successor and superset of <code>experiments.incrementalRebuild</code>, aiming to bring further rebuild performance improvement and faster HMR to developers.</p>
<p>In a case of 10000 React components, the HMR becomes 38% faster:</p>

<p>In Rspack v1.1 you can enable this feature in development mode by:</p>
<pre><code meta="">const isDev = process.env.NODE_ENV === 'development';

export default {
  mode: isDev ? 'development' : 'production',
  experiments: {
    incremental: isDev,
  },
};
</code></pre>
<blockquote>
<p>See <a href="/config/experiments#experimentsincremental">experiments.incremental</a> for more details.</p>
</blockquote>
<p>This is still an experimental feature and we need more work to stabilize it. If you are interested, give it a try and send bug reports and feedback to <a href="https://github.com/web-infra-dev/rspack/issues/8106" target="_blank" rel="noopener noreferrer">#8106</a>.</p>
<h2 id="new-features">New features<a aria-hidden="true" href="#new-features">#</a></h2>
<h3 id="improved-html-plugin">Improved HTML plugin<a aria-hidden="true" href="#improved-html-plugin">#</a></h3>
<p>In earlier versions of Rspack, the built-in <a href="/plugins/rspack/html-rspack-plugin">HtmlRspackPlugin</a> was implemented. However, its capabilities were severely lacking. It lacked some configuration options and did not support <code>hooks</code>, which made those plugins implemented based on the <code>hooks</code> of <code>HtmlWebpackPlugin</code> incompatible with Rspack.</p>
<p>Therefore, we refactored <code>HtmlRspackPlugin</code>. While supporting most of the configuration options of <code>HtmlWebpackPlugin</code>, we also completed the alignment of <code>hooks</code>. Now you can get these hooks through <code>HtmlRspackPlugin.getCompilationHooks</code> and use them to modify the content of the HTML assets like below:</p>
<pre><code meta="">const DeferPlugin = {
  apply(compiler) {
    compiler.hooks.compilation.tap('DeferPlugin', (compilation) => {
      const hooks = HtmlRspackPlugin.getCompilationHooks(compilation);
      hooks.alterAssetTags.tapPromise('DeferPlugin', async (data) => {
        // Add `defer` attribute to all script tags
        for (const tag of data.assetTags.scripts) {
          if (tag.tagName === 'script') {
            tag.attributes.defer = true;
          }
        }
      });
    });
  },
};

export default {
  plugins: [new HtmlRspackPlugin(), DeferPlugin],
};
</code></pre>
<blockquote>
<p>See <a href="/plugins/rspack/html-rspack-plugin">HtmlRspackPlugin</a> for more details.</p>
</blockquote>
<h3 id="improved-jsdoc">Improved JSDoc<a aria-hidden="true" href="#improved-jsdoc">#</a></h3>
<p>Rspack uses <a href="https://github.com/colinhacks/zod" target="_blank" rel="noopener noreferrer">zod</a> to validate user configurations and infer all configuration types. However, the inferred types lack JSDoc comments and the generated types are quite complex and hard to understand.</p>
<p>To fix this, we recently refactored the configuration types and added JSDoc comments for all of them to improve readability.</p>

<blockquote>
<p>We're still looking to improve the JSDoc. If you're interested, feel free to submit pull requests. ❤️</p>
</blockquote>
<h2 id="ecosystem">Ecosystem<a aria-hidden="true" href="#ecosystem">#</a></h2>
<h3 id="docusaurus-faster">Docusaurus Faster<a aria-hidden="true" href="#docusaurus-faster">#</a></h3>
<p><a href="https://docusaurus.io/blog/releases/3.6" target="_blank" rel="noopener noreferrer">Docusaurus v3.6</a> brings the <code>Docusaurus Faster</code> options that allow users to use Rspack as the bundler for Docusaurus sites.</p>
<p>The <a href="https://docusaurus.io/blog/releases/3.6#docusaurus-faster" target="_blank" rel="noopener noreferrer">Docusaurus Faster</a> project's goal is to reduce the build times and memory consumption of Docusaurus. Docusaurus team have worked on multiple optimizations and modernized their infrastructure to use faster Rust-based tools like Rspack and SWC.</p>
<p>Benchmarks on community site show that the production site can build 2 to 4 times faster.</p>
<h3 id="nuxt-rspack-builder">Nuxt Rspack builder<a aria-hidden="true" href="#nuxt-rspack-builder">#</a></h3>
<p><a href="https://nuxt.com/blog/v3-14" target="_blank" rel="noopener noreferrer">Nuxt v3.14</a> brings a new first-class Nuxt builder for Rspack.</p>
<p>It's still experimental and Nuxt team refactored the internal Nuxt virtual file system to use <code>unplugin</code> to make this possible.</p>
<p>You can try <a href="https://github.com/danielroe/nuxt-rspack-starter" target="_blank" rel="noopener noreferrer">nuxt-rspack-starter</a> to get started, or install <a href="https://www.npmjs.com/package/@nuxt/rspack-builder" target="_blank" rel="noopener noreferrer">@nuxt/rspack-builder</a> and set <code>builder: &#39;rspack&#39;</code> in the Nuxt config file.</p>
<h2 id="rsbuild-v11">Rsbuild v1.1<a aria-hidden="true" href="#rsbuild-v11">#</a></h2>
<p>Rsbuild v1.1 upgraded to Rspack v1.1 and introduced several new features.</p>
<h3 id="cli-shortcuts">CLI shortcuts<a aria-hidden="true" href="#cli-shortcuts">#</a></h3>
<p>Rsbuild now supports enabling CLI shortcuts through the <a href="https://rsbuild.rs/config/dev/cli-shortcuts" target="_blank" rel="noopener noreferrer">dev.cliShortcuts</a> config. If you are using Rsbuild CLI, it is enabled by default.</p>
<p>The CLI shortcut allows you to clear the console, open the browser, restart the server, or customize any shortcut you want.</p>

<h3 id="view-static-assets">View static assets<a aria-hidden="true" href="#view-static-assets">#</a></h3>
<p>Rsbuild dev server now provides a report page at <code>/rsbuild-dev-server</code> that allows you to view all static assets generated during the current build.</p>

<h3 id="new-configurations">New configurations<a aria-hidden="true" href="#new-configurations">#</a></h3>
<p>Rsbuild 1.1 introduced some new configurations:</p>
<ul>
<li><a href="https://rsbuild.rs/config/server/base" target="_blank" rel="noopener noreferrer">server.base</a>: Set the base path of the server.</li>
<li><a href="https://rsbuild.rs/config/source/assets-include" target="_blank" rel="noopener noreferrer">source.assetsInclude</a>: Set the additional files that should be treated as static assets.</li>
<li><a href="https://rsbuild.rs/config/output/filename" target="_blank" rel="noopener noreferrer">output.filename.assets</a>: Set the name of other static assets.</li>
<li><a href="https://rsbuild.rs/config/output/dist-path" target="_blank" rel="noopener noreferrer">output.distPath.assets</a>: Set the output directory of other static assets.</li>
</ul>
<h2 id="upgrade-guide">Upgrade guide<a aria-hidden="true" href="#upgrade-guide">#</a></h2>
<h3 id="upgrade-swc-plugins">Upgrade SWC plugins<a aria-hidden="true" href="#upgrade-swc-plugins">#</a></h3>
<p>In Rspack v1.1, the Rust crate <code>swc_core</code> has been upgraded to <code>5.0.1</code>. Users of the SWC Wasm plugin need to ensure version consistency with <code>swc_core</code> being used, otherwise, it may lead to unforeseen issues.</p>
<p>For more details, see <a href="https://swc.rs/docs/plugin/selecting-swc-core" target="_blank" rel="noopener noreferrer">SWC documentation</a>.</p>
<h3 id="hash-function">Hash function<a aria-hidden="true" href="#hash-function">#</a></h3>
<p>Rspack's <a href="/config/output#outputhashfunction">output.hashFunction</a> now defaults to the faster <code>xxhash64</code>, and the <a href="/config/output#outputhashdigestlength">output.hashDigestLength</a> now defaults to <code>16</code> (prev <code>20</code>). This change will bring a significant performance improvement for large projects.</p>
<p>If you prefer the previous hash function, you can set:</p>
<pre><code meta="">export default {
  output: {
    hashFunction: 'md5',
    hashDigestLength: 20,
  },
};
</code></pre>
<blockquote>
<p>Related PR: <a href="https://github.com/web-infra-dev/rspack/pull/8249" target="_blank" rel="noopener noreferrer">#8249</a>.</p>
</blockquote>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.0 alpha]]></title>
            <link>https://rspack.rs/blog/announcing-1-0-alpha</link>
            <guid>/blog/announcing-1-0-alpha</guid>
            <pubDate>Sat, 29 Jun 2024 16:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>June 29, 2024</em></p>
<h1 id="announcing-rspack-10-alpha">Announcing Rspack 1.0 alpha<a aria-hidden="true" href="#announcing-rspack-10-alpha">#</a></h1>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-0-alpha.png" alt=""></img></p>
<p>Rspack 1.0 alpha is now available on npm!</p>
<p>Before releasing Rspack 1.0 stable version, we will test for 1~2 months to improve the API stability and reliability of v1.0 and to verify its impact on downstream projects.</p>
<p>Rspack 1.0 stable version is expected to be released this August. This is a significant milestone as it means that Rspack has implemented the major features and APIs of webpack. This will allow thousands of webpack projects to make a smooth transition while achieving significant improvements in build performance.</p>
<h2 id="outputs-optimization">Outputs optimization<a aria-hidden="true" href="#outputs-optimization">#</a></h2>
<p>Rspack 1.0 enables the <code>optimization.concatenateModules</code> by default during production builds. This option enables module concatenation optimization, also known as scope hoisting.</p>
<pre><code meta="">export default {
  optimization: {
    // Now enabled by default in production
    concatenateModules: mode === 'production',
  },
};
</code></pre>
<p>The primary purpose of module concatenation is to merge multiple modules into a single function, thereby reducing the overhead associated with parsing and executing JavaScript code in the browser. By merging modules, redundant code such as import and export statements between modules can be reduced, resulting in smaller bundle sizes.</p>
<p>With module concatenation enabled, the output size of Rspack can be reduced by about <strong>4% to 10%</strong> (before Gzip).</p>
<p>Currently, Rspack has implemented most of the optimization strategies aligned with webpack. In future versions, Rspack will explore and make improvements based on webpack to provide deeper optimizations and smaller output sizes.</p>
<h2 id="builtin-lightning-css">Builtin Lightning CSS<a aria-hidden="true" href="#builtin-lightning-css">#</a></h2>
<p>Rspack 1.0 has built-in integration with <a href="https://github.com/parcel-bundler/lightningcss" target="_blank" rel="noopener noreferrer">Lightning CSS</a>. Lightning CSS is an extremely fast CSS parser, transformer, bundler, and minifier written in Rust.</p>
<p>The new version of Rspack has implemented the CSS minimizer plugin based on Lightning CSS, and it is now the default CSS minimizer of Rspack. Compared to the previously used SWC CSS minimizer plugin, it applies more optimizations to make the CSS output smaller.</p>
<pre><code meta="">export default {
  optimization: {
    minimizer: [
      // The default CSS minimizer changed:
-     new rspack.SwcCssMinimizerRspackPlugin()
+     new rspack.LightningCssMinimizerRspackPlugin()
    ],
  },
};
</code></pre>
<p>You can switch back to <code>SwcCssMinimizerRspackPlugin</code> by following configuration.</p>
<pre><code>export default {
  optimization: {
    minimizer: [
      new rspack.SwcJsMinimizerRspackPlugin(),
      new rspack.SwcCssMinimizerRspackPlugin(),
    ],
  },
};
</code></pre>
<p>For example, Rspack already has tree shaking for CSS Modules, but it only removes unused CSS Modules classnames referenced by JS files. With the <a href="https://lightningcss.dev/minification.html#unused-symbols" target="_blank" rel="noopener noreferrer">unusedSymbols</a> option of Lightning CSS, Rspack can now eliminate unused declarations in CSS Modules files, including IDs, keyframes, CSS variables or other CSS identifiers.</p>
<p>We believe that Lightning CSS will become the shared foundation for the next generation build tools, and Rspack will support more CSS compilation features based on Lightning CSS.. Thanks to <a href="https://github.com/devongovett" target="_blank" rel="noopener noreferrer">@devongovett</a> for creating such an excellent tool.</p>
<h2 id="lean-core">Lean core<a aria-hidden="true" href="#lean-core">#</a></h2>
<p>To ensure the long term stability of Rspack v1, we have removed some non-core features that were built into the Rspack core. This allows the core to be lean and focused on providing common bundler features.</p>
<p>In v0.x, Rspack core has built-in SWC plugins to support Emotion, Styled Components, and Relay. This is because in the early days Rspack did not support the use of SWC Wasm plugins and could only integrate them into the core.</p>
<p>Currently, Rspack supports the use of SWC plugins via <a href="/guide/features/builtin-swc-loader#jscexperimentalplugins">experimental.plugins</a> in <code>builtin:swc-loader</code>. So we have removed the built-in plugins from the Rspack core, including:</p>
<ul>
<li><a href="https://www.npmjs.com/package/@swc/plugin-emotion" target="_blank" rel="noopener noreferrer">@swc/plugin-emotion</a></li>
<li><a href="https://www.npmjs.com/package/@swc/plugin-relay" target="_blank" rel="noopener noreferrer">@swc/plugin-relay</a></li>
<li><a href="https://www.npmjs.com/package/@swc/plugin-styled-components" target="_blank" rel="noopener noreferrer">@swc/plugin-styled-components</a></li>
</ul>
<p>Take <code>@swc/plugin-styled-components</code> as an example. In v1.0, you can use it as follows.</p>
<ul>
<li>Installation:</li>
</ul>
<pre><code>npm i @swc/plugin-styled-components -D
</code></pre>
<ul>
<li>Configuration:</li>
</ul>
<pre><code>export default {
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        loader: &quot;builtin:swc-loader&quot;,
        options: {
-         rspackExperiments: {
-           styledComponents: {},
-         },
          jsc: {
+           experimental: {
+             plugins: [[&quot;@swc/plugin-styled-components&quot;, {}]],
+           },
          },
        },
      },
    ],
  },
};
</code></pre>
<h2 id="bundling-css">Bundling CSS<a aria-hidden="true" href="#bundling-css">#</a></h2>
<p>Rspack 1.0 aligns with the webpack <a href="/config/experiments#experimentscss">experiment.css</a> default value, making it easier to migrate from webpack to Rspack.</p>
<p>In the webpack ecosystem, there are three common approaches to bundling CSS files:</p>
<ol>
<li>Use <a href="https://github.com/webpack/css-loader" target="_blank" rel="noopener noreferrer">css-loader</a> and <a href="https://github.com/webpack/mini-css-extract-plugin" target="_blank" rel="noopener noreferrer">mini-css-extract-plugin</a> to generate standalone CSS files.</li>
<li>Use <a href="https://github.com/webpack/css-loader" target="_blank" rel="noopener noreferrer">css-loader</a> and <a href="https://github.com/webpack/style-loader" target="_blank" rel="noopener noreferrer">style-loader</a> to inject CSS through <code>&lt;style&gt;</code> tags.</li>
<li>Use <a href="/config/experiments#experimentscss">experiment.css</a>, an experimental feature introduced in webpack 5 that provides native CSS support.</li>
</ol>
<p>In version 0.x, Rspack enabled <code>experiment.css</code> by default, which would conflict with css-loader. Users had to manually disable <code>experiment.css</code> to use css-loader.</p>
<p>Starting with Rspack 1.0, the default value of <code>experiment.css</code> changes to <code>false</code>, in line with webpack, allowing users to use any of the above approaches.</p>
<p>You can add the following configuration to continue using <code>experiment.css</code>:</p>
<pre><code meta="">export default {
  experiments: {
    css: true,
  },
};
</code></pre>
<h2 id="how-to-upgrade">How to upgrade<a aria-hidden="true" href="#how-to-upgrade">#</a></h2>
<p>To install the alpha version of Rspack and Rspack CLI:</p>
<pre><code># npm
npm add -D --save-exact @rspack/core@alpha @rspack/cli@alpha

# yarn
yarn add -D --save-exact @rspack/core@alpha @rspack/cli@alpha

# pnpm
pnpm add -D --save-exact @rspack/core@alpha @rspack/cli@alpha
</code></pre>
<p>During the Rspack alpha testing, new versions will still introduce some breaking changes, which we will highlight in the changelog. Please read the changelog to understand the differences before upgrading.</p>
<p>For Rsbuild users, please wait for the release of Rsbuild 1.0 alpha version (expected in 1-2 weeks).</p>
<h2 id="breaking-changes">Breaking changes<a aria-hidden="true" href="#breaking-changes">#</a></h2>
<h3 id="resolvetsconfigpath">resolve.tsConfigPath<a aria-hidden="true" href="#resolvetsconfigpath">#</a></h3>
<p><code>resolve.tsConfigPath</code> config has been removed, please use <a href="/config/resolve#resolvetsconfig">resolve.tsConfig</a> instead.</p>
<pre><code meta="">export default {
  resolve: {
-   tsConfigPath: path.resolve(__dirname, './tsconfig.json'),
+   tsConfig: path.resolve(__dirname, './tsconfig.json'),
  },
};
</code></pre>
<h3 id="rspackexperimentsstyledcomponents">rspackExperiments.styledComponents<a aria-hidden="true" href="#rspackexperimentsstyledcomponents">#</a></h3>
<p>The <code>rspackExperiments.styledComponents</code> option of <code>builtin:swc-loader</code> has been removed, please use <a href="https://www.npmjs.com/package/@swc/plugin-styled-components" target="_blank" rel="noopener noreferrer">@swc/plugin-styled-components</a> instead.</p>
<pre><code>export default {
  module: {
    rules: [
      {
        test: /\.jsx$/,
        loader: &quot;builtin:swc-loader&quot;,
        options: {
-         rspackExperiments: {
-           styledComponents: true,
-         },
          jsc: {
+           experimental: {
+             plugins: [[&quot;@swc/plugin-styled-components&quot;, {}]],
+           },
          },
        },
      },
    ],
  },
};
</code></pre>
<h3 id="rspackexperimentsemotion">rspackExperiments.emotion<a aria-hidden="true" href="#rspackexperimentsemotion">#</a></h3>
<p>The <code>rspackExperiments.emotion</code> option of <code>builtin:swc-loader</code> has been removed, please use <a href="https://www.npmjs.com/package/@swc/plugin-emotion" target="_blank" rel="noopener noreferrer">@swc/plugin-emotion</a> instead.</p>
<pre><code>export default {
  module: {
    rules: [
      {
        test: /\.jsx$/,
        loader: &quot;builtin:swc-loader&quot;,
        options: {
-         rspackExperiments: {
-           emotion: true,
-         },
          jsc: {
+           experimental: {
+             plugins: [[&quot;@swc/plugin-emotion&quot;, {}]],
+           },
          },
        },
      },
    ],
  },
};
</code></pre>
<h3 id="rspackexperimentsrelay">rspackExperiments.relay<a aria-hidden="true" href="#rspackexperimentsrelay">#</a></h3>
<p>The <code>rspackExperiments.relay</code> option of <code>builtin:swc-loader</code> has been removed, please use <a href="https://www.npmjs.com/package/@swc/plugin-relay" target="_blank" rel="noopener noreferrer">@swc/plugin-relay</a> instead.</p>
<pre><code>export default {
  module: {
    rules: [
      {
        test: /\.jsx$/,
        loader: &quot;builtin:swc-loader&quot;,
        options: {
-         rspackExperiments: {
-           relay: true,
-         },
          jsc: {
+           experimental: {
+             plugins: [[&quot;@swc/plugin-relay&quot;, {}]],
+           },
          },
        },
      },
    ],
  },
};
</code></pre>
<h3 id="others">Others<a aria-hidden="true" href="#others">#</a></h3>
<p>Other breaking changes:</p>
<ul>
<li><code>optimization.chunkIds</code> defaults to <code>&#39;natural&#39;</code> when <code>mode === &#39;none&#39;</code>, see <a href="https://github.com/web-infra-dev/rspack/pull/6956" target="_blank" rel="noopener noreferrer">#6956</a>.</li>
<li><code>optimization.moduleIds</code> defaults to <code>&#39;natural&#39;</code> when <code>mode === &#39;none&#39;</code>, see <a href="https://github.com/web-infra-dev/rspack/pull/6956" target="_blank" rel="noopener noreferrer">#6956</a>.</li>
<li>Rust crate <code>swc_core</code> has been upgraded to <code>0.95.x</code>, please upgrade your SWC Wasm plugin, see <a href="https://github.com/web-infra-dev/rspack/pull/6887" target="_blank" rel="noopener noreferrer">#6887</a>.</li>
<li>Removed <code>output.amdContainer</code>, use <code>output.library.amdContainer</code> instead, see <a href="https://github.com/web-infra-dev/rspack/pull/6958" target="_blank" rel="noopener noreferrer">#6958</a>.</li>
<li>Removed <code>Compilation.currentNormalModuleHooks</code>, see <a href="https://github.com/web-infra-dev/rspack/pull/6859" target="_blank" rel="noopener noreferrer">#6859</a>.</li>
<li>Removed <code>stats.modules[].profile.integration</code>, see <a href="https://github.com/web-infra-dev/rspack/pull/6947" target="_blank" rel="noopener noreferrer">#6947</a>.</li>
<li>Removed some options for <code>SwcJsMinimizerRspackPluginOptions</code>, see <a href="https://github.com/web-infra-dev/rspack/pull/6950" target="_blank" rel="noopener noreferrer">#6950</a>.</li>
</ul>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.0]]></title>
            <link>https://rspack.rs/blog/announcing-1-0</link>
            <guid>/blog/announcing-1-0</guid>
            <pubDate>Sat, 29 Jun 2024 16:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>August 28, 2024</em></p>
<h1 id="announcing-rspack-10">Announcing Rspack 1.0<a aria-hidden="true" href="#announcing-rspack-10">#</a></h1>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-0.png" alt=""></img></p>
<hr></hr>
<p><strong>We are excited to introduce Rspack 1.0!</strong></p>
<p>Rspack is a next-generation JavaScript bundler written in Rust, compatible with the webpack API and ecosystem, and is 10 times faster than webpack.</p>
<p>Eighteen months ago, we open-sourced Rspack 0.1 and received substantial feedback and contributions from the community. During this time, 170 contributors have joined in the development of Rspack, submitting over 5000 pull requests and more than 2000 issues, which have helped Rspack release over 80 versions. And Rspack's weekly downloads on npm have exceeded 100,000 🎉.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-0-stats.png" alt="Rspack Stats"></img></p>
<p>Today Rspack has reached a new milestone - 1.0. This means that Rspack is production-ready, covers most of webpack's APIs and features, and is now prepared to support more users.</p>
<h2 id="whos-using-rspack">Who's using Rspack<a aria-hidden="true" href="#whos-using-rspack">#</a></h2>
<p>Since Rspack was open-sourced, many enterprises and developers have used Rspack in production. The weekly npm downloads of Rspack have also exceeded 100,000.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-0-downloads.png" alt="Rspack downloads"></img></p>
<p>Within ByteDance, Rspack's weekly downloads exceed 400,000, and over 1,000 web applications use Rspack, including TikTok, Douyin, Lark, Coze, and more. These projects have significantly improved build times and iteration efficiency by using Rspack. This has also helped us identify some early design issues with Rspack, prompting us to improve the architecture and strike a balance between migration cost, performance, and flexibility.</p>
<p>We have also seen an increasing number of enterprise users starting to use Rspack, including Microsoft, Amazon, Alibaba, Intuit, Bit.dev, Discord, and others. We are excited that Rspack can help these enterprise users to achieve progressive migration, and we look forward to further cooperation and communication with more enterprises and developers in the future.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-0-who-is-using.png" alt="Who is using"></img></p>
<h2 id="new-features">New features<a aria-hidden="true" href="#new-features">#</a></h2>
<p>Since the release of 0.1, Rspack has introduced numerous important features and optimizations, including:</p>
<h3 id="better-performance">Better performance<a aria-hidden="true" href="#better-performance">#</a></h3>
<p>As a Rust-based bundler, performance has always been a core focus for Rspack. Since the release of Rspack 0.1, we have made numerous performance improvements, optimized its performance for different scenarios, and added key features such as <a href="/config/experiments#experimentslazycompilation">lazy compilation</a> to ensure better performance in large projects.</p>
<p>Here is a comparison of build performance between Rspack 0.1 and Rspack 1.0 from the <a href="https://github.com/rstackjs/build-tools-performance" target="_blank" rel="noopener noreferrer">benchmark</a>. Rspack has significantly improved build performance while also adding many new features:</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-0-benchmark.png" alt="Rspack benchmark"></img></p>
<p>Note that the current architecture and implementation of Rspack still have significant room for optimization. After the 1.0 release, we plan to further improve the performance by several times to better support large-scale applications.</p>
<h3 id="better-compatibility">Better compatibility<a aria-hidden="true" href="#better-compatibility">#</a></h3>
<p>When 0.1 was first released, Rspack had not yet implemented many webpack APIs and hooks, limiting its compatibility with webpack plugins and loaders. This required us to fork some community libraries to adapt them for Rspack, such as the early versions of <a href="https://www.npmjs.com/package/@rspack/plugin-html" target="_blank" rel="noopener noreferrer">@rspack/plugin-html</a>, <a href="https://www.npmjs.com/package/@rspack/plugin-minify" target="_blank" rel="noopener noreferrer">@rspack/plugin-minify</a>, and <a href="https://www.npmjs.com/package/@rspack/plugin-node-polyfill" target="_blank" rel="noopener noreferrer">@rspack/plugin-node-polyfill</a>.</p>
<p>As the API support has gradually improved, Rspack has added support for more and more webpack plugins and loaders. Currently, Rspack is compatible with almost all loaders in the community. For the 50 most downloaded <a href="/guide/compatibility/plugin">webpack plugins</a>, more than 80% can be used in Rspack or have an alternative.</p>
<p>Building on this foundation, Rspack supports more libraries and frameworks, including React, Preact, Vue, Solid, Svelte, and NestJS. We would also like to thank the maintainers of many community plugins who have actively adapted their work for Rspack, such as <a href="https://github.com/unjs/unplugin" target="_blank" rel="noopener noreferrer">unplugin</a> and <a href="https://www.npmjs.com/package/node-polyfill-webpack-plugin" target="_blank" rel="noopener noreferrer">node-polyfill-webpack-plugin</a>. Special thanks to <a href="https://github.com/alexander-akait" target="_blank" rel="noopener noreferrer">Alexander Akait</a>, one of the main maintainers of webpack, who helped us support many webpack loaders and plugins.</p>
<p>We also hope to support and create more community plugins to further enrich the webpack and Rspack ecosystem.</p>
<h3 id="smaller-bundle-size">Smaller bundle size<a aria-hidden="true" href="#smaller-bundle-size">#</a></h3>
<p>Rspack has consistently prioritized minimizing the bundle size of production builds. Since the release of 0.1, Rspack has gradually aligned its optimization capabilities with webpack, implementing features such as <a href="/plugins/webpack/split-chunks-plugin#splitchunksplugin">split chunks</a>, <a href="/guide/optimization/tree-shaking">tree shaking</a>, <a href="/config/optimization#optimizationconcatenatemodules">scope hoisting</a> and <a href="/config/optimization#optimizationmangleexports">mangle exports</a>.</p>
<p>When a project migrates from webpack to Rspack, these features ensure that the bundle size remains the same as webpack while improving DX. In some scenarios, the output size of Rspack has even slightly outperformed webpack.</p>
<p>For example, in a real-world medium-sized web application, the bundle size of Rspack 1.0 was optimized from 6600KB to 5900KB compared to Rspack 0.1, which is equivalent to webpack. In the future, Rspack will continue to explore more advanced solutions to optimize bundle size.</p>
<h3 id="support-for-module-federation-20">Support for Module Federation 2.0<a aria-hidden="true" href="#support-for-module-federation-20">#</a></h3>
<p><a href="https://module-federation.io/" target="_blank" rel="noopener noreferrer">Module Federation</a> is a micro-frontend architectural pattern widely used in the ecosystem. The Rspack team has been working with the Module Federation team to develop Module Federation 2.0. This new version provides features such as dynamic TS type hints, Chrome devtools, runtime plugins, preloading. These features make Module Federation more suitable for use as a micro-frontend architecture in large-scale web applications.</p>
<p>Rspack also provides backwards compatibility and support for Module Federation 1.0, making it easier for webpack projects to migrate.</p>
<h3 id="stable-api-and-new-website">Stable API and new website<a aria-hidden="true" href="#stable-api-and-new-website">#</a></h3>
<p>In 1.0, we have improved the stability of the configuration, JavaScript API, and plugin API. This ensures that higher-level tools and frameworks can more easily integrate with Rspack. We have also improved the guides and API documentation on the official website.</p>
<p>Rspack 1.0 also includes a brand new <a href="/">homepage</a>. Many thanks to designer Emily Jackson and team member <a href="https://github.com/ScriptedAlchemy" target="_blank" rel="noopener noreferrer">Zack Jackson</a> for their efforts in making this happen.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-0-homepage.png" alt="Rspack Homepage"></img></p>
<h2 id="why-rspack">Why Rspack<a aria-hidden="true" href="#why-rspack">#</a></h2>
<p>Over the past two years, the community has seen the birth of several Rust-based bundlers, all of which have demonstrated remarkable performance. Rspack not only provides first-class performance. It also leads the community in terms of flexibility and compatibility.</p>
<p>The current goals of Rspack are:</p>
<ul>
<li>To help existing webpack projects progressively migrate to a high performance bundler, so that build performance is no longer a bottleneck for fast iterations.</li>
<li>Rspack is not just suitable for environments like browser and Node.js that we are familiar with; its goal is to cover all environments where JavaScript runs. This means that Rspack can easily support Deno, Electron, cross-platform applications, MiniApps, and any other JavaScript runtime.</li>
<li>We found that balancing "flexibility" and "out-of-the-box" in a single tool was a challenging task. Therefore, after open-sourcing Rspack, we developed a set of Rstack toolchains, including projects such as Rsbuild, Rspress, Rsdoctor, and Rslib, each targeting different use cases. For example, to reduce the complexity and high barriers to configuring Rspack, we provide Rsbuild for an out-of-the-box development experience.</li>
</ul>
<h3 id="rstack">Rstack<a aria-hidden="true" href="#rstack">#</a></h3>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-0-rstack.png" alt="Rstack"></img></p>
<p>Rstack is short for "Rspack Stack" and stands for the tech stack centered on Rspack. It consists of the following tools:</p>
<ul>
<li><a href="https://github.com/web-infra-dev/rspack" target="_blank" rel="noopener noreferrer">Rspack</a>: Focuses on implementing the high performance bundler, balancing performance and flexible configuration.</li>
<li><a href="https://github.com/web-infra-dev/rsbuild" target="_blank" rel="noopener noreferrer">Rsbuild</a>: Focuses on building web applications, providing an out-of-the-box development experience.</li>
<li><a href="https://github.com/web-infra-dev/rslib" target="_blank" rel="noopener noreferrer">Rslib</a>: Focuses on building libraries, providing high quality ESM and CJS outputs.</li>
<li><a href="https://github.com/web-infra-dev/rspress" target="_blank" rel="noopener noreferrer">Rspress</a> Focuses on generating static sites and supports MDX for building documentation sites and blogs.</li>
<li><a href="https://github.com/web-infra-dev/rsdoctor" target="_blank" rel="noopener noreferrer">Rsdoctor</a> Focuses on build analysis, helping developers resolve build-related issues.</li>
</ul>
<p>Together these tools make up the Rstack. We aim to provide a unified set of web development tools that deliver a top tier experience for both developers and users.</p>
<h3 id="compatibility-with-webpack">Compatibility with webpack<a aria-hidden="true" href="#compatibility-with-webpack">#</a></h3>
<p>Rspack 1.0 is designed to be compatible with webpack v5, which will help many projects using webpack to migrate smoothly to Rspack. While maintaining compatibility with webpack, Rspack 1.0 also embraces modern web standards and aims for ultimate build performance.</p>
<ul>
<li>For web standards, Rspack actively follows the evolution of modern web standards and the latest developments from TC39 and web standards. For example, Rspack already supports the use of Web Workers through <a href="https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker" target="_blank" rel="noopener noreferrer">new Worker()</a>, supports importing JSON modules through <a href="https://github.com/tc39/proposal-import-attributes" target="_blank" rel="noopener noreferrer">Import Attributes</a>, and supports importing CSS based on the <a href="https://web.dev/articles/css-module-scripts" target="_blank" rel="noopener noreferrer">CSS Module Scripts</a> specification.</li>
<li>For performance, we have introduced many optimizations in 1.0. For example, if a JavaScript-side hook is not used, the Rust side will not invoke communication with the JavaScript side. Also, Rspack performs lazy loading for many message objects. Even if the message object is large, if JavaScript only consumes a subset of its properties, Rspack will only transfer the consumed data, minimizing the communication overhead between Rust and JavaScript. And Rspack plans to provide even more lightweight hooks in the future to achieve more efficient communication between Rust and JavaScript.</li>
</ul>
<p>In future major releases, Rspack will evolve based on the webpack API to better meet the needs of modern web development.</p>
<h2 id="how-to-use-10">How to use 1.0<a aria-hidden="true" href="#how-to-use-10">#</a></h2>
<p>If you are using Rspack 0.7 or an earlier version, please note that 1.0 contains some breaking changes. We have prepared detailed documentation to help you upgrade. Please refer to: <a href="/guide/migration/rspack_0.x">Migration from Rspack 0.x</a>.</p>
<p>If you have never used Rspack before, please see <a href="/guide/start/quick-start">Quick Start</a> to get started with Rspack. Also, feel free to give a star 🌟 to the <a href="https://github.com/web-infra-dev/rspack" target="_blank" rel="noopener noreferrer">Rspack GitHub repository</a>.</p>
<h2 id="whats-next">What's next<a aria-hidden="true" href="#whats-next">#</a></h2>
<p>Rspack 1.0 marks a new beginning. Following this release, the Rspack team will focus on the following goals:</p>
<ul>
<li><strong>Develop Rspack 1.x.</strong> Rspack 1.x will iterate over 12 to 18 months, bringing more new features and improvements.</li>
<li><strong>Release Rsbuild 1.0.</strong> It is based on Rspack 1.0 and supports <a href="https://rsbuild.rs/guide/advanced/environments" target="_blank" rel="noopener noreferrer">multi-environment builds</a>. Currently, Rsbuild has released version 1.0 RC, and the official release is expected in September.</li>
<li><strong>Release Rsdoctor 1.0.</strong> This release will improve support for Vue and provide <a href="https://github.com/web-infra-dev/rsdoctor/issues/408" target="_blank" rel="noopener noreferrer">report formats</a> for CI/CD.</li>
<li><strong>Develop Rslib 0.x.</strong> Rslib is a library building tool based on Rsbuild. See <a href="https://github.com/web-infra-dev/rslib" target="_blank" rel="noopener noreferrer">Rslib repository</a> for more details.</li>
<li><strong>Develop Rspress 2.0.</strong> It will be based on React 19 and will improve some of the API designs. See <a href="https://github.com/web-infra-dev/rspress/discussions/1105" target="_blank" rel="noopener noreferrer">Rspress v2.0 planning</a> for more details.</li>
</ul>
<p>Here are some key features we plan to support in Rspack 1.x:</p>
<h3 id="faster-hmr">Faster HMR<a aria-hidden="true" href="#faster-hmr">#</a></h3>
<p>Rspack can currently meet the performance requirements for most projects, but there is still significant room for performance optimization. During development, Rspack has already achieved nearly constant level incremental builds during the make phase. However, in the seal phase, some computations can still slow down as projects scale. Rspack will incrementally optimize the computations in the seal phase to keep the HMR time at a constant level.</p>
<h3 id="portable-cache">Portable cache<a aria-hidden="true" href="#portable-cache">#</a></h3>
<p>The evolution path of Rspack's caching capabilities follows a sequential implementation of memory cache, persistent cache, and portable cache. Currently, Rspack has implemented a memory cache that provides excellent HMR performance. The next step is to implement a persistent cache based on this foundation to address long cold startup times for large projects and to functionally align with webpack.</p>
<p>After that, we plan to continue implementing <strong>portable cache</strong>. This means that Rspack's build cache will not only be persistent, but also portable across environments and machines. This will help teams make better use of the cache and lay the groundwork for distributed builds.</p>
<h3 id="typescript-based-optimization">TypeScript-based optimization<a aria-hidden="true" href="#typescript-based-optimization">#</a></h3>
<p>Currently, when Rspack processes TypeScript modules, it first converts them to JavaScript through a loader before further processing. This provides flexibility but also hinders further optimization of the build output. For example, developers need to use <code>enum</code> instead of <code>const enum</code>, but <code>enum</code> is difficult to optimize as a constant. In the future, we plan to treat TypeScript as a first-class citizen in Rspack, leveraging TypeScript's static information to provide more advanced compile-time optimization of the build output (such as <a href="https://github.com/google/closure-compiler/wiki/Type-Based-Property-Renaming" target="_blank" rel="noopener noreferrer">type-based property renaming</a>).</p>
<h3 id="stable-rust-api">Stable Rust API<a aria-hidden="true" href="#stable-rust-api">#</a></h3>
<p>Currently, higher-level tools can use the JS API to integrate Rspack, which provides good extensibility. However, the communication overhead between Rust and JavaScript that limits the performance of Rspack. We also provide the <a href="/guide/features/builtin-swc-loader#jscexperimentalplugins">SWC Wasm plugin</a> to support extensions, but its performance is still slower than native languages.To provide higher-level tools with more flexible integration options and better performance, we plan to expose Rspack's Rust API for integration.</p>
<h3 id="react-server-components-support">React Server Components support<a aria-hidden="true" href="#react-server-components-support">#</a></h3>
<p>At ByteDance, we have experimentally supported RSC (React Server Components) based on Rspack and validated it in a large web application. In the future, Rspack will provide first-class support for RSC, with more core features to make RSC easier to implement. For example, Rspack now supports the <a href="/config/experiments#experimentslayers">layer</a> feature, which allows to build for multiple environments in a single run.</p>
<h3 id="improved-esm-output">Improved ESM output<a aria-hidden="true" href="#improved-esm-output">#</a></h3>
<p>ESM is the standard for JavaScript modules. We are currently improving Rspack and webpack's support for ESM output and creating a library build tool based on Rspack called Rslib. This will allow developers to make better use of ESM's static analysis and tree-shaking when building npm packages.</p>
<h2 id="acknowledgements">Acknowledgements<a aria-hidden="true" href="#acknowledgements">#</a></h2>
<p>The development of Rspack would not have been possible without the contributions and support of the awesome community. Special thanks to:</p>
<ul>
<li>The <a href="https://nx.dev/" target="_blank" rel="noopener noreferrer">NX team</a> for trusting in Rspack and integrating it early during its open-source phase.</li>
<li><a href="https://github.com/zackarychapple" target="_blank" rel="noopener noreferrer">Zack Chapple</a> and the <a href="https://www.zephyr-cloud.io/" target="_blank" rel="noopener noreferrer">Zephyr team</a> for helping to promote Rspack.</li>
<li>The <a href="https://github.com/unjs/unplugin" target="_blank" rel="noopener noreferrer">Unplugin team</a> for actively helping to integrate Rspack and enriching the plugin ecosystem.</li>
<li><a href="https://github.com/aweary" target="_blank" rel="noopener noreferrer">Brandon Dail</a> for using Rspack on Discord and helping us spread the word.</li>
<li><a href="https://github.com/xc2" target="_blank" rel="noopener noreferrer">Kaffi Y</a> for tirelessly helping users and answering Rspack-related questions on GitHub and Discord.</li>
<li>All the developers participating in ByteDance's Rspack Innovator project, such as <a href="https://x.com/Dominus_Kelvin" target="_blank" rel="noopener noreferrer">Kelvin Omereshone</a>, <a href="https://x.com/_yanpes" target="_blank" rel="noopener noreferrer">Yannik Peschke</a>, <a href="https://x.com/RussellCanfield" target="_blank" rel="noopener noreferrer">Russell Canfield</a>, and <a href="https://x.com/KyryloBashtenko" target="_blank" rel="noopener noreferrer">Kyrylo</a> who gave us early feedback and advice.</li>
<li>All the companies and users who have been using Rspack since version 0.x, their valuable suggestions have helped Rspack to progress.</li>
</ul>
<p>In the open source community, Rspack won the 2024 <a href="https://osawards.com/javascript/" target="_blank" rel="noopener noreferrer">Breakthrough of the Year Award</a>, which is a great encouragement for the Rspack team. We would like to thank all the developers who voted for Rspack.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-0-osawards.png" alt="Rspack OSS Awards"></img></p>
<p>Since the 0.1 release, we have established good collaborations with several community teams:</p>
<ul>
<li>While aligning with webpack, we worked with the webpack team to improve support for native CSS and ESM output. In the process, the Rspack team submitted over 100 commits to webpack. Special thanks to <a href="https://github.com/alexander-akait" target="_blank" rel="noopener noreferrer">Alexander Akait</a> for his review feedback.</li>
<li>We also worked with the SWC team, contributing the Preact Refresh SWC plugin and fixing some transform and minify bugs in SWC. Thanks to <a href="https://github.com/kdy1" target="_blank" rel="noopener noreferrer">kdy</a> for his review feedback.</li>
<li>Rspack has embraced the <a href="https://github.com/unjs/unplugin" target="_blank" rel="noopener noreferrer">unplugin</a> ecosystem and fully supports the unplugin API. Thanks to <a href="https://github.com/sxzz" target="_blank" rel="noopener noreferrer">sxzz</a> for his review feedback and <a href="https://github.com/antfu" target="_blank" rel="noopener noreferrer">antfu</a> for his remarkable creativity.</li>
</ul>
<p>We are also excited to see Rspack being used or integrated into a wider ecosystem, including <a href="https://medium.com/@yanirmanor/why-moving-to-rspack-and-how-to-use-it-with-bazel-9f66139fe493" target="_blank" rel="noopener noreferrer">Bazel</a>, <a href="https://github.com/rstackjs/storybook-rsbuild" target="_blank" rel="noopener noreferrer">Storybook</a>, <a href="https://github.com/noshower/electron-forge-plugin-rspack" target="_blank" rel="noopener noreferrer">Electron</a>, and more.</p>
<p>Finally, we would like to thank all the developers who have contributed to the Rspack ecosystem ❤️:</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-0-contributors.png" alt="Rspack Contributors"></img></p>
<h2 id="faq">FAQ<a aria-hidden="true" href="#faq">#</a></h2>
<h3 id="what-does-the-10-release-mean">What does the 1.0 release mean?<a aria-hidden="true" href="#what-does-the-10-release-mean">#</a></h3>
<p>The 1.0 release means that Rspack has implemented the core features of webpack and achieved API stability. Over the next 12 to 18 months, we will ensure the stability of the Rspack 1.x API so that developers can confidently build frameworks and tools on top of it. During the 1.x iteration, we may still find some designs require polishing in Rspack. We will address these through progressive upgrades using <a href="/config/experiments#experimentsrspackfuture">future flags</a>.</p>
<h3 id="when-will-rsbuild-10-be-released">When will Rsbuild 1.0 be released?<a aria-hidden="true" href="#when-will-rsbuild-10-be-released">#</a></h3>
<p>We are currently preparing for the release of Rsbuild 1.0, which is scheduled for early September.</p>
<p>We have also released the Rsbuild 1.0 RC version, and there will be no further breaking changes introduced for Rsbuild. Please refer to <a href="https://rsbuild.rs/guide/migration/rsbuild-0-x" target="_blank" rel="noopener noreferrer">Migrating from Rsbuild 0.x</a> to upgrade to Rsbuild 1.0 RC.</p>
<h3 id="does-rspack-follow-semantic-versioning">Does Rspack follow semantic versioning?<a aria-hidden="true" href="#does-rspack-follow-semantic-versioning">#</a></h3>
<p>Rspack follows semantic versioning (semver) and will not introduce breaking changes to the public API in minor or patch releases. Note that there are some exceptions:</p>
<blockquote>
<p>If your project has strict requirements for semantic versioning, you can pin Rspack to a minor version.</p>
</blockquote>
<h4 id="experimental-features">Experimental features<a aria-hidden="true" href="#experimental-features">#</a></h4>
<p>Rspack provides some experimental features that can be used via the <a href="/config/experiments">experiments</a> config. In minor releases, Rspack may make changes to the APIs of these experimental features and provide detailed explanations of these changes in the release notes. So if you are using experimental features, please pay attention to the minor release notes.</p>
<h4 id="swc-related-features">SWC related features<a aria-hidden="true" href="#swc-related-features">#</a></h4>
<p>Rspack is built on SWC, which is currently in the pre-1.0 phase. To keep up with the fixes and improvements in SWC, we regularly update the SWC version. This may include some breaking changes in SWC or break some versions of the SWC Wasm plugins. In such cases, we will release a minor version of Rspack and add a note to the changelog. if the SWC upgrade doesn't contain any breaking changes, we may upgrade SWC in a patch or minor release.</p>
<h4 id="types">Types<a aria-hidden="true" href="#types">#</a></h4>
<p>In minor releases, the types exported by Rspack may change for the following reasons:</p>
<ul>
<li>TypeScript itself does not follow semver. It may introduce some breaking changes in minor releases that require Rspack to adjust its types.</li>
<li>Rspack may use some features introduced in higher versions of TypeScript, which could affect projects using lower versions of TypeScript.</li>
</ul>
<h4 id="bugfix-for-webpack-compatibility">Bugfix for webpack compatibility<a aria-hidden="true" href="#bugfix-for-webpack-compatibility">#</a></h4>
<p>If the webpack API was mistakenly implemented in earlier versions of Rspack, we may fix it in non-major versions to align with the webpack API's behavior.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 0.7]]></title>
            <link>https://rspack.rs/blog/announcing-0-7</link>
            <guid>/blog/announcing-0-7</guid>
            <pubDate>Tue, 28 May 2024 16:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>May 28, 2024</em></p>
<h1 id="announcing-rspack-07">Announcing Rspack 0.7<a aria-hidden="true" href="#announcing-rspack-07">#</a></h1>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v0-7.png" alt=""></img></p>
<p>Rspack v0.7 has been released!</p>
<p>This is the last minor release before the Rspack v1.0. After this, the Rspack team will focus on the development of v1.0 and aim to launch the Rspack v1.0 alpha version soon.</p>
<p>Notable changes in Rspack v0.7:</p>
<ul>
<li><a href="#support-for-lazy-compilation">Support for Lazy Compilation</a>: Significantly improves the dev startup performance of large applications by compiling on demand.</li>
<li><a href="#faster-css-builds">Faster CSS Build</a>: Introducing a new css-module-lexer, which increases CSS bundling speed by 4 times.</li>
<li><a href="#breaking-changes">Breaking changes</a>: Removed some unstable APIs to make default behaviors more consistent with webpack.</li>
</ul>
<h2 id="support-for-lazy-compilation">Support for lazy compilation<a aria-hidden="true" href="#support-for-lazy-compilation">#</a></h2>
<p>Rspack v0.7 now supports lazy compilation, which is very helpful for improving the dev startup performance of multi-page applications (MPA) or large single-page applications (SPA).</p>
<h3 id="what-is-lazy-compilation">What is lazy compilation<a aria-hidden="true" href="#what-is-lazy-compilation">#</a></h3>
<p>Lazy compilation is an excellent way to improve startup performance. It compiles modules on demand rather than compiling all modules at startup. This means developers can quickly see the application running when they start the dev server and build the necessary modules in stages.</p>
<h3 id="why-need-lazy-compilation">Why need lazy compilation<a aria-hidden="true" href="#why-need-lazy-compilation">#</a></h3>
<p>Although Rspack itself has good performance, the overall build time can still be less than ideal when building applications with a large number of modules. This is because the modules in the application need to be compiled by various loaders, such as <code>postcss-loader</code>, <code>sass-loader</code>, <code>vue-loader</code>, etc., which introduce additional compilation overhead.</p>
<p>With lazy compilation enabled, Rspack will only compile the entrypoints and dynamic import modules that are requested. This can significantly reduce the number of modules that are compiled at development startup, improving startup time.</p>
<p>Consider the following scenario:</p>
<p>Your team is developing an MPA application with dozens of pages. Most of the time, you only work on a few pages and don't need to build the code for other pages. In this case, you can enable lazy compilation, allowing Rspack to compile only the modules referenced by the pages you access.</p>
<p>When lazy compilation is enabled, Rspack treats "entry points" and "dynamic imports" as split points. For example:</p>
<pre><code meta="">if (someCondition) {
  import('./b.js');
}
</code></pre>
<p>When we compile a.js, Rspack treats b.js as an empty module, as if no code had ever been written to it. As soon as we need to access b.js, Rspack fills the b.js module with its original content, as if the user had just written that piece of code.</p>
<p>Take the Rspack documentation site as an example, it contains several pages. With lazy compilation is enabled, only the entry points and their dependent modules will be built. This greatly improves startup speed, reducing the startup time from 2.1 seconds to 0.05 seconds.</p>
<p>When a developer accesses a particular page of the site, the build for that page is triggered, and this build time will still be significantly less than the full build time.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/lazy-compilation-compare.png" alt="lazy-compilation-compare"></img></p>
<h3 id="how-to-use">How to use<a aria-hidden="true" href="#how-to-use">#</a></h3>
<p>Now, you can enable the lazy compilation feature in Rspack through the <a href="/config/experiments#experimentslazycompilation">experiments.lazyCompilation</a> configuration:</p>
<pre><code meta="">const isDev = process.env.NODE_ENV === 'development';

export default {
  experiments: {
    lazyCompilation: isDev,
  },
};
</code></pre>
<p>Please note that the current lazy compilation aligns with the webpack implementation, <strong>and is still in the experimental stage</strong>. In some scenarios, lazy compilation might not work as expected, or the performance improvement may be insignificant.</p>
<p>We will continue to improve the usability of lazy compilation in different scenarios to achieve a more stable state. If you encounter any issues while using it, feel free to provide feedback to us via <a href="https://github.com/web-infra-dev/rspack/issues" target="_blank" rel="noopener noreferrer">GitHub Issues</a>.</p>
<h2 id="faster-css-builds">Faster CSS builds<a aria-hidden="true" href="#faster-css-builds">#</a></h2>
<p>In v0.7, we have refactored the internal implementation of the <a href="/config/experiments#experimentscss">experiments.css</a>.</p>
<p>For CSS dependency analysis, we have developed <a href="https://github.com/ahabhgk/css-module-lexer" target="_blank" rel="noopener noreferrer">css-module-lexer</a> using Rust. This is a high performance lexer for CSS Modules that can parse CSS or CSS Modules and return their dependency metadata.</p>
<p>With the integration of css-module-lexer, Rspack can now support more complex CSS Modules syntax, making its behaviour align with webpack's <code>css-loader</code>. For example, it can support the following CSS Modules syntax:</p>
<pre><code meta="">:local(.parent):global(.child) > ul {
  color: red;
}
</code></pre>
<p>The CSS parsing process before and after the refactor is shown in the diagram below:</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-css-lexer.png" alt="rspack-css-lexer"></img></p>
<p><code>css-module-lexer</code> has also brought significant performance improvements to Rspack's <code>experiments.css</code>. In performance tests, the building performance of <code>bootstrap.css</code> has increased by about 4x.</p>
<ul>
<li>Before refactoring: ~84 ms (analyzing CSS dependencies ~71 ms)</li>
<li>After refactoring: ~25 ms (analyzing CSS dependencies ~11 ms)</li>
</ul>
<h2 id="breaking-changes">Breaking changes<a aria-hidden="true" href="#breaking-changes">#</a></h2>
<p>Rspack will gradually remove all unstable APIs and configurations before version 1.0, and more configurations / APIs / default behaviors will be align with webpack.</p>
<h3 id="deprecating-unstable-javascript-apis">Deprecating unstable JavaScript APIs<a aria-hidden="true" href="#deprecating-unstable-javascript-apis">#</a></h3>
<p>Rspack early exposed some APIs that were intended for internal use only and were unstable, such as <code>compiler.compilation</code> and <code>compiler.builtinPlugins</code>. These APIs were not stable and could not be used in webpack.</p>
<p>In v0.7, we reorganized the currently exposed APIs and their interface definitions. If you have been using these APIs, you will need to make the necessary adjustments to align with the implementations consistent with webpack.</p>
<p>The following APIs are deprecated:</p>
<ul>
<li><code>compiler.builtinPlugins</code></li>
<li><code>compiler.compilation</code></li>
<li><code>compiler.compilationParams</code></li>
<li><code>compiler.getAsset(name)</code></li>
<li><code>statsError.formatted</code></li>
<li><code>statsWarning.formatted</code></li>
<li>...</li>
</ul>
<p>For details about the deprecated API, please refer to <a href="https://github.com/web-infra-dev/rspack/pull/6448" target="_blank" rel="noopener noreferrer">rspack#6448</a>, <a href="https://github.com/web-infra-dev/rspack/pull/6505" target="_blank" rel="noopener noreferrer">rspack#6505</a>.</p>
<h3 id="css-import-rules-must-precede-all-other-rules">CSS @import rules must precede all other rules<a aria-hidden="true" href="#css-import-rules-must-precede-all-other-rules">#</a></h3>
<p>In Rspack 0.7, we have partially refactored the internal implementation of <a href="/config/experiments#experimentscss">experiments.css</a>.</p>
<p>After refactoring, when <code>@import</code> is not at the top, you will get the following error. In this case, you need to manually adjust the <code>@import</code> rule to the top.</p>
<pre><code>ERROR in ./src/main.css
  × Module parse failed:
  ╰─▶   × CSS parsing warning: Any &#39;@import&#39; rules must precede all other rules
         ╭─[4:1]
       4 │ };
       5 │
       6 │ @import &#39;bootstrap/dist/css/bootstrap.css&#39;;
         · ───────
       7 │
       8 │
         ╰────

  help:
        You may need an appropriate loader to handle this file type.
</code></pre>
<h3 id="remove-builtins-and-experimentsrspackfuturenewtreeshaking">Remove builtins and experiments.rspackFuture.newTreeshaking<a aria-hidden="true" href="#remove-builtins-and-experimentsrspackfuturenewtreeshaking">#</a></h3>
<p>v0.7 has removed the <code>builtins.treeShaking</code> (oldTreeShaking) and <code>experiments.rspackFuture.newTreeshaking</code> (new tree shaking switch) configurations, taking the old tree shaking functionality completely offline.</p>
<h3 id="remove-resolvebrowserfield">Remove resolve.browserField<a aria-hidden="true" href="#remove-resolvebrowserfield">#</a></h3>
<p>This configuration is shorthand for <code>resolve.aliasFields = [&quot;browser&quot;]</code>, and since Rspack already supports <code>resolve.aliasFields</code>, this configuration is no longer necessary.</p>
<h3 id="remove-experimentsnewsplitchunks">Remove experiments.newSplitChunks<a aria-hidden="true" href="#remove-experimentsnewsplitchunks">#</a></h3>
<p>This configuration is used to enable the new splitChunks implementation, and since Rspack already uses the new splitChunks implementation by default, this configuration is no longer needed.</p>
<h3 id="remove-snapshot">Remove snapshot<a aria-hidden="true" href="#remove-snapshot">#</a></h3>
<p>This configuration is used to control the snapshot strategy when using cache. Under Rspack's current incremental rebuild architecture, cache no longer relies on snapshot, so this configuration is no longer needed.</p>
<h3 id="remove-exportsconvention-for-module-type-css">Remove exportsConvention for module type css<a aria-hidden="true" href="#remove-exportsconvention-for-module-type-css">#</a></h3>
<p>This configuration is used to control the naming convention of CSS module exports in experiments.css. It only has an effect on modules with the module type <code>css/module</code>, which have exports. For modules with the module type <code>css</code>, there are no exports, so this configuration is not needed.</p>
<h3 id="upgrade-swc-to-091x">Upgrade SWC to 0.91.x<a aria-hidden="true" href="#upgrade-swc-to-091x">#</a></h3>
<p>Upgraded the Rust crate <code>swc_core</code> to <code>0.91.x</code>. This will affect users of the SWC Wasm plugin.</p>
<h2 id="migration-guide">Migration guide<a aria-hidden="true" href="#migration-guide">#</a></h2>
<h3 id="upgrade-the-swc-plugins">Upgrade the SWC plugins<a aria-hidden="true" href="#upgrade-the-swc-plugins">#</a></h3>
<p>In version v0.7, the Rust crate <code>swc_core</code> has been upgraded to <code>0.91.x</code>. Users of the SWC Wasm plugin need to ensure version consistency with <code>swc_core</code> being used, otherwise, it may lead to unforeseen issues.</p>
<p>For more details, please see this <a href="https://swc.rs/docs/plugin/selecting-swc-core#091x" target="_blank" rel="noopener noreferrer">document</a> of SWC.</p>
<h3 id="replace-resolvebrowserfield-with-resolvealiasfields">Replace resolve.browserField with resolve.aliasFields<a aria-hidden="true" href="#replace-resolvebrowserfield-with-resolvealiasfields">#</a></h3>
<p>If you previously configured <code>resolve.browserField</code>, you will need to replace it with <code>resolve.aliasFields</code>:</p>
<ul>
<li><code>resolve.browserField = true</code> is replaced with <code>resolve.aliasFields = [&quot;browser&quot;]</code></li>
<li><code>resolve.browserField = false</code> is replaced with <code>resolve.aliasFields = []</code></li>
</ul>
<h3 id="remove-generatorcssexportsconvention">Remove generator.css.exportsConvention<a aria-hidden="true" href="#remove-generatorcssexportsconvention">#</a></h3>
<p>If you previously configured <code>module.generator.css.exportsConvention</code> or <code>generator.exportsConvention</code> in <code>module.rule</code>, you only need to delete that configuration.</p>
<h2 id="rsbuild-v07">Rsbuild v0.7<a aria-hidden="true" href="#rsbuild-v07">#</a></h2>
<p>Rsbuild v0.7 has been released with Rspack v0.7, please read <a href="https://rsbuild.rs/community/releases/v0-7" target="_blank" rel="noopener noreferrer">Announcing Rsbuild v0.7</a> to learn more.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 0.6]]></title>
            <link>https://rspack.rs/blog/announcing-0-6</link>
            <guid>/blog/announcing-0-6</guid>
            <pubDate>Wed, 10 Apr 2024 16:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>April 10, 2024</em></p>
<h1 id="announcing-rspack-06">Announcing Rspack 0.6<a aria-hidden="true" href="#announcing-rspack-06">#</a></h1>
<h2 id="major-feature-updates">Major feature updates<a aria-hidden="true" href="#major-feature-updates">#</a></h2>
<h3 id="built-in-support-for-mini-css-extract-plugin">Built-in support for mini-css-extract-plugin<a aria-hidden="true" href="#built-in-support-for-mini-css-extract-plugin">#</a></h3>
<p>Now you can use <code>rspack.CssExtractRspackPlugin</code> as a replacement for <code>mini-css-extract-plugin</code>.</p>
<p>This is very useful in some scenarios, for example when the built-in CSS parser cannot meet your needs, there are more customized CSS Modules names, or you want to use some loaders that depend on the output of css-loader, but still want to extract the CSS into a separate file.</p>
<p>For more details, please see <a href="/plugins/rspack/css-extract-rspack-plugin#cssextractrspackplugin">CssExtractRspackPlugin</a>.</p>
<pre><code meta="">

export default {
  plugins: [new rspack.CssExtractRspackPlugin()],
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: [rspack.CssExtractRspackPlugin.loader, 'css-loader'],
      },
    ],
  },
};
</code></pre>
<blockquote>
<p>There is an basic <a href="https://github.com/rstackjs/rstack-examples/tree/main/rspack/react-with-extract-css" target="_blank" rel="noopener noreferrer">project example</a>.</p>
</blockquote>
<h3 id="enable-new-tree-shaking-by-default">Enable new tree shaking by default<a aria-hidden="true" href="#enable-new-tree-shaking-by-default">#</a></h3>
<p>In Rspack 0.1.0, basic tree shaking functionality was introduced. Due to the initial architecture being unstable, we employed a relatively simplistic approach to implement the basic version of tree shaking (only support unused export variables elimination). However, as rspack's capabilities improved, the architecture gradually stabilized.</p>
<p>The basic tree shaking functionality was insufficient to meet user needs, for example:</p>
<ol>
<li>It couldn't handle circular references and couldn't provide enough optimization information for other build stages to achieve further optimization (such as mangleExports, concatenateModules, barrel exports optimization).</li>
<li>Some interoperability-related issues often occurred, such as worker-thread modules, Common Js modules, module federation, etc.</li>
</ol>
<p>To address these issues, we decided to adopt a webpack-like approach, re-implementing the entire optimization process from the bottom up. In version 0.4.2, we introduced the <code>experiments.rspackFuture.newTreeshaking</code> configuration to experimentally enable the new optimization algorithm.
After four months of bug fixing and optimization, the new tree shaking algorithm has become relatively stable. Therefore, we've decided to default-enable the new tree shaking algorithm in version 0.6.0.</p>
<h2 id="breaking-changes">Breaking changes<a aria-hidden="true" href="#breaking-changes">#</a></h2>
<h3 id="remove-experimentsrspackfuturedisableapplyentrylazily">Remove experiments.rspackFuture.disableApplyEntryLazily<a aria-hidden="true" href="#remove-experimentsrspackfuturedisableapplyentrylazily">#</a></h3>
<p>The <code>experiments.rspackFuture.disableApplyEntryLazily</code> option has been enabled by default since v0.5.0 and was removed in v0.6.0.</p>
<h3 id="remove-compilerbuild-and-compilerrebuild">Remove compiler.build and compiler.rebuild<a aria-hidden="true" href="#remove-compilerbuild-and-compilerrebuild">#</a></h3>
<p><code>compiler.build</code> and <code>compiler.rebuild</code> are not part of the webpack public API and have now been removed.</p>
<h3 id="remove-builtinscss-and-introduce-css-related-moduleparser-and-modulegenerator-options">Remove builtins.css and introduce CSS related module.parser and module.generator options<a aria-hidden="true" href="#remove-builtinscss-and-introduce-css-related-moduleparser-and-modulegenerator-options">#</a></h3>
<p>Remove <code>builtins.css</code>, please replace it with the CSS-related <a href="/config/module#moduleparsercssauto"><code>module.parser</code></a> and <a href="/config/module#modulegeneratorcssauto"><code>module.generator</code></a> options that have been introduced.</p>
<p>Also, starting from v0.6.0, Rspack's experiments CSS will align with webpack's experiments CSS as a target, which means that, like webpack experiments CSS, it will no longer support <a href="https://caniuse.com/css-variables" target="_blank" rel="noopener noreferrer">browsers that do not support CSS variables</a> in the future. Therefore, for those projects that need to use configurations not yet supported by experiments CSS, or need to support older browsers, we recommend migrating to <a href="/plugins/rspack/css-extract-rspack-plugin.html"><code>rspack.CssExtractRspackPlugin</code></a>.</p>
<p>In v0.6.0, we introduced three new types of <code>module.generator</code> and <code>module.parser</code> options: <code>css/auto</code>, <code>css</code>, and <code>css/module</code>, which will only take effect when experiments.css is enabled, checkout <a href="https://github.com/rstackjs/rstack-examples/tree/main/rspack/css-parser-generator-options" target="_blank" rel="noopener noreferrer">this example</a> about how to use it.</p>
<p>In the <code>module.parser</code> options, module types <code>css</code>, <code>css/auto</code>, and <code>css/module</code> all include the <code>namedExports</code> property. It has replaced the <code>builtins.css.namedExports</code> configuration.</p>
<p>For the <code>module.generator</code> options, the <code>css/auto</code> and <code>css/module</code> module types offer the <code>exportsOnly</code>, <code>exportsConvention</code>, and <code>localIdentName</code> properties. The <code>css</code> type includes only the <code>exportsOnly</code> and <code>exportsConvention</code> properties. <code>exportsOnly</code>, <code>exportsConvention</code>, and <code>localIdentName</code> respectively replace <code>builtins.css.modules.exportsOnly</code>, <code>builtins.css.modules.localsConvention</code>, and <code>builtins.css.modules.localIdentName</code>.</p>
<p>In addition, there are some changes to the default values:</p>
<ol>
<li>
<p>The value of <code>exportsConvention</code> has changed from <code>&#39;asIs&#39;</code>, <code>&#39;camelCaseOnly&#39;</code>, etc., to <code>&#39;as-is&#39;</code>, <code>&#39;camel-case-only&#39;</code>, etc., to maintain consistency with webpack experiments css.</p>
</li>
<li>
<p>With <code>namedExports: false</code>, it is now possible to use default exports, named exports, and namespace exports at the same time; previously, only the default export was supported:</p>
<pre><code>// Before v0.6.0, only default export was supported


// Now, in addition to default export, it also supports:
// Namespace exports

// Named exports

// Default and named exports used together

</code></pre>
</li>
<li>
<p>The default value of <code>namedExports</code> changed from <code>false</code> to <code>true</code>, meaning you'll have to use a namespace <code>) or named </code>) by default, which will improve future compatibility with <a href="https://web.dev/articles/css-module-scripts" target="_blank" rel="noopener noreferrer">native CSS module</a>. And this does not mean you have to migrate all imports at once; you can disable this behavior by setting <code>namedExports: false</code>, and since now <code>namedExports: false</code> also supports named export and namespace export, you can migrate these imports progressively.</p>
</li>
<li>
<p>The default value of <code>localIdentName</code> has changed from <code>&#39;[path][name][ext]__[local]&#39;</code> in development mode and <code>&#39;[hash]&#39;</code> in production mode to <code>&#39;[uniqueName]-[id]-[local]&#39;</code> in both development and production modes, which will slightly improve the gzip compression size of the CSS output.</p>
</li>
<li>
<p>The default value of <code>exportsOnly</code> in <code>target: &#39;node&#39;</code> has changed from <code>false</code> to <code>true</code>.</p>
</li>
<li>
<p>The default rule type for CSS has changed from <code>css</code> to <code>css/auto</code>. <code>css/auto</code> will automatically process CSS files with <code>.module.</code> or <code>.modules.</code> as infixes as <a href="https://github.com/css-modules/css-modules" target="_blank" rel="noopener noreferrer">CSS Modules</a>, consistent with <a href="https://github.com/webpack/css-loader?tab=readme-ov-file#auto" target="_blank" rel="noopener noreferrer"><code>css-loader</code>'s <code>modules.auto: true</code></a>, which will <a href="https://github.com/webpack/webpack/issues/16572" target="_blank" rel="noopener noreferrer">simplify the writing rules for using less or sass with CSS Modules</a>.</p>
</li>
</ol>
<h3 id="upgrade-swc-to-090x">Upgrade SWC to 0.90.x<a aria-hidden="true" href="#upgrade-swc-to-090x">#</a></h3>
<p>Upgraded the Rust crate <code>swc_core</code> to <code>0.90.x</code>. This will affect users of the SWC Wasm plugin.</p>
<h3 id="emit-warnings-when-css-order-is-inconsistent-in-multiple-chunks">Emit warnings when CSS order is inconsistent in multiple chunks<a aria-hidden="true" href="#emit-warnings-when-css-order-is-inconsistent-in-multiple-chunks">#</a></h3>
<p>When the order of CSS in multiple chunks is inconsistent, a warning will be issued. For example, if you have two entries, <code>entryA</code> and <code>entryB</code>, where <code>entryA</code> imports <code>a.css</code> and then <code>b.css</code>, while <code>entryB</code> imports <code>b.css</code> and then <code>a.css</code>.
When splitChunks conditions are met, <code>a.css</code> and <code>b.css</code> will become a separate chunk. The order of <code>a.css</code> and <code>b.css</code> in this chunk cannot be guaranteed, resulting in the following warning.</p>
<pre><code>WARNING in ⚠ chunk src_a_css-src_b_-5c8c53 [css-extract-rspack-plugin]
  │ Conflicting order. Following module has been added:
  │  * css ./css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./src/a.css
  │ despite it was not able to fulfill desired ordering with these modules:
  │  * css ./css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./src/b.css
  │   - couldn&#39;t fulfill desired order of chunk group(s) parent2
  │   - while fulfilling desired order of chunk group(s) parent1
</code></pre>
<p>If you are sure that their order inconsistency does not matter, you can ignore this error by configuring <code>ignoreWarnings</code>.</p>
<pre><code meta="">export default {
  ignoreWarnings: [/Conflicting order/],
};
</code></pre>
<h2 id="migration-guide">Migration guide<a aria-hidden="true" href="#migration-guide">#</a></h2>
<h3 id="apply-rspackcssextractrspackplugin">Apply rspack.CssExtractRspackPlugin<a aria-hidden="true" href="#apply-rspackcssextractrspackplugin">#</a></h3>
<p>If you have used <code>mini-css-extract-plugin</code> and webpack before, you can simply replace <code>mini-css-extract-plugin</code> by <code>rspack.CssExtractPlugin</code>.</p>
<pre><code meta="">+ 
- 

export default {
  plugins: [new rspack.CssExtractRspackPlugin()],
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: [CssExtract.loader, 'css-loader'],
      },
    ],
  },
};
</code></pre>
<h3 id="migrate-from-builtinscss">Migrate from builtins.css<a aria-hidden="true" href="#migrate-from-builtinscss">#</a></h3>
<ol>
<li>Use <code>module.parser[&quot;css/auto&quot;].namedExports</code> to replace <code>builtins.css.namedExports</code>.</li>
<li>Use <code>module.generator[&quot;css/auto&quot;].exportsOnly</code> to replace <code>builtins.css.modules.exportsOnly</code>.</li>
<li>Use <code>module.generator[&quot;css/auto&quot;].exportsConvention</code> to replace <code>builtins.css.modules.localsConvention</code>.</li>
<li>Use <code>module.generator[&quot;css/auto&quot;].localIdentName</code> to replace <code>builtins.css.modules.localIdentName</code>.</li>
</ol>
<p>The above occurrences of <code>&quot;css/auto&quot;</code> are the default module type for CSS, which can be modified to <code>&quot;css&quot;</code> or <code>&quot;css/module&quot;</code> as needed.</p>
<p>Add the following configuration to maintain the original default behavior of <code>builtins.css</code>, which can be modified as needed based on the following setup:</p>
<pre><code meta="">export default {
+  module: {
+    generator: {
+      "css/auto": {
+        exportsOnly: false,
+        exportsConvention: 'as-is',
+        localIdentName: isProduction ? '[hash]' : '[path][name][ext]__[local]',
+      },
+      "css": {
+        exportsOnly: false,
+        exportsConvention: 'as-is',
+      },
+      "css/module": {
+        exportsOnly: false,
+        exportsConvention: 'as-is',
+        localIdentName: isProduction ? '[hash]' : '[path][name][ext]__[local]',
+      },
+    },
+    parser: {
+      "css/auto": {
+        namedExports: false,
+      },
+      "css": {
+        namedExports: false,
+      },
+      "css/module": {
+        namedExports: false,
+      },
+    },
+  },
}
</code></pre>
<p>If it is necessary to configure some modules separately, you can use the <a href="/config/module-rules#rulesparser"><code>rules[].parser</code></a> and <a href="/config/module-rules#rulesgenerator"><code>rules[].generator</code></a> options in <code>module.rules</code>.</p>
<h3 id="migrate-to-compilerrun">Migrate to compiler.run<a aria-hidden="true" href="#migrate-to-compilerrun">#</a></h3>
<p><code>compiler.build</code> or <code>compiler.rebuild</code> have been deprecated. Please switch to <code>compiler.run</code> for both building and rebuilding.</p>
<h3 id="upgrade-the-swc-plugins">Upgrade the SWC plugins<a aria-hidden="true" href="#upgrade-the-swc-plugins">#</a></h3>
<p>In version <code>0.6.0</code>, the Rust crate <code>swc_core</code> has been upgraded to <code>0.90.x</code>. Users of the SWC Wasm plugin need to ensure version consistency with <code>swc_core</code> being used, otherwise, it may lead to unforeseen issues.</p>
<p>For more details, please see this <a href="https://swc.rs/docs/plugin/selecting-swc-core#090x" target="_blank" rel="noopener noreferrer">document</a> of SWC.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 0.5]]></title>
            <link>https://rspack.rs/blog/announcing-0-5</link>
            <guid>/blog/announcing-0-5</guid>
            <pubDate>Tue, 09 Jan 2024 16:52:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>January 09, 2024</em></p>
<h1 id="announcing-rspack-05">Announcing Rspack 0.5<a aria-hidden="true" href="#announcing-rspack-05">#</a></h1>
<h2 id="major-feature-updates">Major feature updates<a aria-hidden="true" href="#major-feature-updates">#</a></h2>
<h3 id="module-federation-added-to-rspack">Module Federation added to Rspack<a aria-hidden="true" href="#module-federation-added-to-rspack">#</a></h3>
<p>Checkout <a href="/blog/module-federation-added-to-rspack">this blog</a> for more details.</p>
<h2 id="breaking-changes">Breaking changes<a aria-hidden="true" href="#breaking-changes">#</a></h2>
<h3 id="optimizationchunkids-is-deterministic-in-production-mode-by-default">optimization.chunkIds is deterministic in production mode by default<a aria-hidden="true" href="#optimizationchunkids-is-deterministic-in-production-mode-by-default">#</a></h3>
<p><code>optimization.chunkIds</code> is <code>&quot;deterministic&quot;</code> now in production mode, which aligns with webpack's default behavior.</p>
<h3 id="support-rspackhotmodulereplacementplugin">Support rspack.HotModuleReplacementPlugin<a aria-hidden="true" href="#support-rspackhotmodulereplacementplugin">#</a></h3>
<p>Support <code>rspack.HotModuleReplacementPlugin</code> in Rspack. If you are not using <code>@rspack/dev-server</code> and using a custom dev server, you need to apply <code>HotModuleReplacementPlugin</code> to enable HMR instead of setting <code>devServer.hot</code> to <code>true</code>, which is the same in webpack. This provides more compatibility with the plugin which uses <code>HotModuleReplacementPlugin</code> internally.</p>
<h3 id="remove-default-transformation">Remove default transformation<a aria-hidden="true" href="#remove-default-transformation">#</a></h3>
<p>Default transformation is a builtin, which internally transforms source files (such as TypeScript), into compatible sources (such as JavaScript). To make the transformation more customizable, we handed out this feature to users by using <code>builtin:swc-loader</code> and dropped the support of several <a href="/config/module-rules#rulestype">rules[].type</a>. These <code>rules[].type</code>s are dropped:</p>
<ul>
<li><code>&quot;typescript&quot;</code> or <code>&quot;ts&quot;</code></li>
<li><code>&quot;tsx&quot;</code></li>
<li><code>&quot;jsx&quot;</code></li>
</ul>
<p>In order to achieve old behavior, please remove <code>rules[].type</code> or change it to <code>&quot;javascript/auto&quot;</code> and apply your custom loader configurations.</p>
<p>To transform a <code>.jsx</code> file:</p>
<pre><code meta="">export default {
  module: {
    rules: [
      {
        test: /\.jsx$/,
        exclude: /[\\/]node_modules[\\/]/,
        loader: 'builtin:swc-loader',
        options: {
          jsc: {
            parser: {
              syntax: 'ecmascript',
              jsx: true,
            },
          },
        },
      },
    ],
  },
};
</code></pre>
<p>To transform a <code>.tsx</code> file:</p>
<pre><code meta="">export default {
  module: {
    rules: [
      {
        test: /\.tsx$/,
        exclude: /[\\/]node_modules[\\/]/,
        loader: 'builtin:swc-loader',
        options: {
          jsc: {
            parser: {
              syntax: 'typescript',
              tsx: true,
            },
          },
        },
      },
    ],
  },
};
</code></pre>
<p>To transform a <code>.ts</code> file:</p>
<pre><code meta="">export default {
  module: {
    rules: [
      {
        test: /\.ts$/,
        exclude: /[\\/]node_modules[\\/]/,
        loader: 'builtin:swc-loader',
        options: {
          jsc: {
            parser: {
              syntax: 'typescript',
            },
          },
        },
      },
    ],
  },
};
</code></pre>
<h3 id="target-does-not-affect-user-code-anymore">target does not affect user code anymore<a aria-hidden="true" href="#target-does-not-affect-user-code-anymore">#</a></h3>
<p>Rspack aligns <a href="/config/target">target</a> with webpack. Instead of transforming arbitrary user code, Rspack now lets loaders control the transformation of user land code. To transform user land code to which your target environment(s) needed, add <code>env</code> to <code>builtin:swc-loader</code>:</p>
<pre><code meta="">export default {
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /[\\/]node_modules[\\/]/,
        loader: "builtin:swc-loader",
        options: {
          jsc: {
            parser: {
              syntax: "ecmascript"
            }
          },
+         env: {
+           targets: "Chrome >= 48"
+         }
        }
      }
    ]
  }
}
</code></pre>
<h3 id="remove-extended-resolve-extensions">Remove extended resolve extensions<a aria-hidden="true" href="#remove-extended-resolve-extensions">#</a></h3>
<p><code>resolve.extensions</code> helps us to omit certain file extensions during resolution. In previous versions, <code>.ts</code>, <code>.tsx</code>, <code>.jsx</code> are supported and these extensions are removed in the latest version, which aligns with webpack's behavior.</p>
<p>In order to get the same behavior, change <code>resolve.extensions</code> to this:</p>
<pre><code meta="">export default {
  resolve: {
    extensions: ['...', '.tsx', '.ts', '.jsx'], // "..." means to extend from the default extensions
  },
};
</code></pre>
<h3 id="make-swchelpers-and-react-refresh-as-peerdependencies">Make @swc/helpers and react-refresh as peerDependencies<a aria-hidden="true" href="#make-swchelpers-and-react-refresh-as-peerdependencies">#</a></h3>
<p>Before we remove default transformation, it's possible to use it to degrade your code to es5 by <code>target</code>, and insert the react refresh helper code into your react component by <code>builtin.react.refresh</code>, so we installed the <code>@swc/helpers</code> and <code>react-refresh</code> as the dependencies of <code>@rspack/core</code>, to provide the out-of-box experience. But since we removed the default transformation now, and recommend using Rsbuild for the out-of-box experience, the <code>@swc/helpers</code> and <code>react-refresh</code> no longer need to be installed by <code>@rspack/core</code>, and we make them as peerDependencies of <code>@rspack/core</code>.</p>
<p>If you are using <code>externalHelpers: true</code> with <code>builtin:swc-loader</code> or <code>swc-loader</code>, now you need to install <code>@swc/helpers</code> as dependencies of your project. If you are using <code>@rspack/plugin-react-refresh</code>, now you need to install <code>react-refresh</code> as devDependencies of your project.</p>
<h3 id="remove-deprecated-builtins-options">Remove deprecated builtins options<a aria-hidden="true" href="#remove-deprecated-builtins-options">#</a></h3>
<p>Some of the builtins options have been deprecated since v0.4.0.</p>
<p>If you are still using <code>builtins.noEmitAssets</code>, <code>builtins.devFriendlySplitChunks</code>, <code>builtins.react</code>, <code>builtins.html</code>, <code>builtins.copy</code>, <code>builtins.minifyOptions</code>, checkout <a href="/blog/announcing-0-4#migrating-builtin-options-to-builtin-plugins">migrating builtin options to builtin plugins</a> to migrate.</p>
<p>And if you are still using <code>builtins.presetEnv</code>, <code>builtins.decorator</code>, <code>builtins.pluginImport</code>, <code>builtins.emotion</code>, <code>builtins.relay</code>, checkout the migration guide <a href="/blog/announcing-0-4#deprecating-default-transformation">here</a>.</p>
<h3 id="remove-builtinsass-loader">Remove builtin:sass-loader<a aria-hidden="true" href="#remove-builtinsass-loader">#</a></h3>
<p><code>builtin:sass-loader</code> has been deprecated since v0.4.0. It's removed in v0.5.0. If you are still using it, migrate to <code>sass-loader</code>.</p>
<h3 id="remove-experimentsincrementalrebuild-options">Remove experiments.incrementalRebuild options<a aria-hidden="true" href="#remove-experimentsincrementalrebuild-options">#</a></h3>
<p><code>experiments.incrementalRebuild</code> options has been deprecated since v0.4.0. It's removed in v0.5.0.</p>
<h3 id="remove-builtinsdevfriendlysplitchunks-and-experimentsnewsplitchunks">Remove builtins.devFriendlySplitChunks and experiments.newSplitChunks<a aria-hidden="true" href="#remove-builtinsdevfriendlysplitchunks-and-experimentsnewsplitchunks">#</a></h3>
<p><code>experiments.newSplitChunks</code> and <code>builtins.devFriendlySplitChunks</code> has been deprecated since v0.4.0. It's removed in v0.5.0.</p>
<h3 id="remove-experimentsrspackfuturenewresolver-options">Remove experiments.rspackFuture.newResolver options<a aria-hidden="true" href="#remove-experimentsrspackfuturenewresolver-options">#</a></h3>
<p><code>experiments.rspackFuture.newResolver</code> has been deprecated since v0.4.0. It's removed in v0.5.0.</p>
<h3 id="deprecating-apply-entry-lazily">Deprecating apply entry lazily<a aria-hidden="true" href="#deprecating-apply-entry-lazily">#</a></h3>
<p>Apply entry lazily is deprecating by rspackFuture: <a href="/config/experiments#experimentsrspackfuturedisableapplyentrylazily">experiments.rspackFuture.disableApplyEntryLazily</a>, which is introduced in v0.4.5, enabled by default in v0.5.0, and will be removed in v0.6.0.</p>
<p>When <code>experiments.rspackFuture.disableApplyEntryLazily</code> is <code>false</code>, <code>options.entry</code> can still make valid changes after <code>rspack(options)</code> is called, but with <code>true</code> it can't, and it's behave the same as webpack5.</p>
<p>This configuration has no effect on users developing applications in Rspack most of the time, but should be noted by developers of Rspack plugins or higher-level frameworks.</p>
<h2 id="migration-guide">Migration guide<a aria-hidden="true" href="#migration-guide">#</a></h2>
<p>v0.5.0 removed lots of deprecated features, except that, v0.5.0 introduced four breaking changes, and you only need to notice two of them if you are developing applications using Rspack. So v0.5.0 is easy to migrate if you already migrate to v0.4+ with no deprecate warnings, if you haven't, checkout the <a href="https://rspack.rs/blog/announcing-0.4#migration-guide" target="_blank" rel="noopener noreferrer">v0.4.0 migration guide</a>.</p>
<h3 id="add-resolveextensions">Add resolve.extensions<a aria-hidden="true" href="#add-resolveextensions">#</a></h3>
<p>This is a breaking change that is most likely to affect you.</p>
<p>After you upgrade <code>@rspack/core</code> to v0.5.0, if you build failed with error: <code>Can&#39;t resolve &#39;./src/foo.tsx&#39;</code>, or <code>Can&#39;t resolve &#39;./src/foo.ts&#39;</code>, or <code>Can&#39;t resolve &#39;./src/foo.jsx&#39;</code>, you need to add <code>resolve.extensions = [&#39;...&#39;, &#39;.tsx&#39;, &#39;.ts&#39;, &#39;.jsx&#39;]</code> in your configuration.</p>
<pre><code>const configuration = {
  resolve: {
+   extensions: [&#39;...&#39;, &#39;.tsx&#39;, &#39;.ts&#39;, &#39;.jsx&#39;],
  },
}
</code></pre>
<p>You only need to add the needed extensions to <code>resolve.extensions</code>. For example, if you are not using any <code>.tsx</code> or <code>.ts</code> files, only using <code>.js</code> or <code>.jsx</code> files, then you only need to add <code>&#39;.jsx&#39;</code> to resolve.extensions. <code>&#39;.js&#39;</code> is one of the default extensions and all default extensions (<code>[&#39;.js&#39;, &#39;.json&#39;, &#39;.wasm&#39;]</code>) are represented by <code>&#39;...&#39;</code>.</p>
<h3 id="install-swchelpers-or-react-refresh">Install @swc/helpers or react-refresh<a aria-hidden="true" href="#install-swchelpers-or-react-refresh">#</a></h3>
<p>This is a breaking change that is most likely to affect you.</p>
<p>After you upgrade <code>@rspack/core</code> to v0.5.0, if you build failed with error: <code>Failed to resolve @swc/helpers/some-helper</code> or <code>Failed to resolve react-refresh/some-module</code>, you need to install <code>@swc/helpers</code> or <code>react-refresh</code> in your project.</p>
<p>If you are using <code>externalHelpers: true</code> with <code>builtin:swc-loader</code> or <code>swc-loader</code>, now you need to install <code>@swc/helpers</code> as dependencies of your project.</p>

<p>If you are using <code>@rspack/plugin-react-refresh</code>, now you need to install <code>react-refresh</code> as devDependencies of your project.</p>

<h3 id="apply-rspackhotmodulereplacementplugin">Apply rspack.HotModuleReplacementPlugin<a aria-hidden="true" href="#apply-rspackhotmodulereplacementplugin">#</a></h3>
<p>If you are using <code>@rspack/cli</code>, or rsbuild, or other higher-level framework of Rspack to develop applications, you don't need to worry about this. This should be well handled by the higher-level framework or cli. But if you are using <code>@rspack/core</code> with a custom dev server (not <code>@rspack/dev-server</code> or <code>webpack-dev-server</code>), or developing a custom dev server, you need to notice this.</p>
<p>Before enabling HMR in Rspack is setting <code>devServer.hot</code> to <code>true</code>, but now you need to apply <code>HotModuleReplacementPlugin</code> by yourself in your custom dev server.</p>
<pre><code>class CustomDevServer {
  enableHMR(compiler) {
-   compiler.options.devServer ??= {};
-   compiler.options.devServer.hot = true;
+   new compiler.rspack.HotModuleReplacementPlugin().apply(compiler);
  }
}
</code></pre>
<h3 id="do-not-change-entry-options-after-rspackoptions">Do not change entry options after rspack(options)<a aria-hidden="true" href="#do-not-change-entry-options-after-rspackoptions">#</a></h3>
<p>If you are using <code>@rspack/cli</code>, or rsbuild, or other higher-level framework of Rspack to develop applications, you don't need to worry about this. This should be well handled by the higher-level framework or cli. But if you are developing a plugin or higher-level framework, you need to notice this.</p>
<p>Before prepending an extra entry in Rspack is prepending it to <code>compiler.options.entry</code>, but now you need to apply <code>EntryPlugin</code> by yourself.</p>
<pre><code>const { rspack } = require(&#39;@rspack/core&#39;);
const compiler = rspack(options);

function prependEntry(compiler, additionalEntry) {
-  for (const key in compiler.options.entry) {
-    compiler.options.entry[key].import = [
-      additionalEntry,
-      ...(compiler.options.entry[key].import || []),
-    ];
-  }
+  new compiler.rspack.EntryPlugin(compiler.context, additionalEntry, {
+    name: undefined, // `name: undefined` to prepend the it to every entry, or add it to a specified entry with specified entry name
+  }).apply(compiler);
}

prependEntry(compiler, &#39;dev-client.js&#39;);
</code></pre>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Module Federation added to Rspack]]></title>
            <link>https://rspack.rs/blog/module-federation-added-to-rspack</link>
            <guid>/blog/module-federation-added-to-rspack</guid>
            <pubDate>Tue, 09 Jan 2024 13:21:00 GMT</pubDate>
            <content:encoded><![CDATA[<h1 id="module-federation-added-to-rspack">Module Federation added to Rspack<a aria-hidden="true" href="#module-federation-added-to-rspack">#</a></h1>
<blockquote>
<p>January 09, 2024</p>
</blockquote>
<h2 id="introducing-rspack-050">Introducing Rspack 0.5.0<a aria-hidden="true" href="#introducing-rspack-050">#</a></h2>
<p>The latest Rspack 0.5.0 introduces the highly anticipated Module Federation along with the new "v1.5" federation APIs. It marks the most substantial revamp of federation since its inception. The v1.5 offers extra capabilities for end users and framework authors, a feat unattainable with the original design.</p>

<h2 id="webpack-federation-gets-some-love">Webpack federation gets some love!<a aria-hidden="true" href="#webpack-federation-gets-some-love">#</a></h2>
<p>Federation API has been opened up for users to enrich, expand, or manage the lifecycle. While v1.5 comes with several new capabilities, it doesn't introduce breaking changes to the API regarding the original Module Federation.</p>
<p>v1.5 is also accessible to webpack via <a href="https://www.npmjs.com/package/@module-federation/enhanced" target="_blank" rel="noopener noreferrer">@module-federation/enhanced</a> with the upper plugin ecosystem, such as the next.js federation or node.js federation plugins, already utilizing v1.5 in their canary releases.</p>
<p>In Rspack, Module Federation v1.5 can be used through <code>rspack.container.ModuleFederationPlugin</code>, and the original Module Federation can be used through <code>rspack.container.ModuleFederationPluginV1</code>.</p>
<h2 id="migration-opportunities">Migration opportunities<a aria-hidden="true" href="#migration-opportunities">#</a></h2>
<p>The support of Module Federation in Rspack opens up a several of creative migration options to speed up bundler tools by sharing code at runtime. Both webpack and Rspack can share code, relying on the same centralized runtime that the Module Federation Group introduced in v1.5. This ensures maintaining feature parity is manageable, and no additional forks of Module Federation are necessary to customize it.</p>
<p><strong>Progressive migration</strong> to Rspack can be achieved via federation. If you have webpack locked plugins or cannot perform a full cut over to rspack, via module federation you can allow Rspack and webpack to share dependencies and code, meaning more code could be built via Rspack while the webpack host does less work but still gets the same result. <a href="https://github.com/module-federation/module-federation-examples/pull/3490" target="_blank" rel="noopener noreferrer">example: webpack Rspack interop</a></p>
<p><strong>Speed up builds by sharing the node_modules via federation</strong>. One could tell webpack to <code>import: false</code> them, and Rspack could compile all the shared modules, reducing the parse overhead and amount of code the webpack part has to do, by delegating it to Rspack where similar workloads take only a few milliseconds to perform. <a href="https://github.com/module-federation/module-federation-examples/pull/3491" target="_blank" rel="noopener noreferrer">example: Rspack Vendor Offload to webpack apps</a></p>
<p><strong>Migrate one at a time</strong>. Since the interfaces between webpack (<a href="https://www.npmjs.com/package/@module-federation/enhanced" target="_blank" rel="noopener noreferrer">@module-federation/enhanced</a>) and Rspack are shared, users can switch over any existing federation build or remote to Rspack. We recommend any remaining webpack builds using <code>@module-federation/enhanced</code> which leverages our new design and exports ModuleFederationPlugin. You can, however, still use the stock plugin that ships in webpack core. Rspack should slot in seamlessly with existing federated applications.</p>
<h2 id="speed-comparison-to-webpack-federation">Speed comparison to webpack federation<a aria-hidden="true" href="#speed-comparison-to-webpack-federation">#</a></h2>
<p>In a simple comparison, using a module federation <a href="https://github.com/module-federation/module-federation-examples/tree/master/comprehensive-demo-react16" target="_blank" rel="noopener noreferrer">example</a></p>
<ul>
<li>Apps: 5</li>
<li>Webpack: 500-3000ms per build - production</li>
<li>Rspack: 130-350ms per build - production</li>
</ul>
<p>Generally, we have observed 5-10x gains in build speeds of federated applications, roughly in line with typical performance gains we see with rspack. Most builds in module federation examples. Development builds we have converted typically take less than 150ms to cold start.</p>
<h2 id="rsbuild-support">Rsbuild support<a aria-hidden="true" href="#rsbuild-support">#</a></h2>
<p>Rsbuild continues to offer a simplified approach to build configurations. It makes working with Rspack feel less like handling a webpack-based build system. Although it's compatible with module federation, Rsbuild will be utilized to offer a more streamlined experience with module federation. For instance, Rsbuild plugins for react could automatically share defaults, or Rsbuild could provide convenient presets and patterns.</p>
<p>We have already initiated the migration of some <a href="https://github.com/module-federation/module-federation-examples" target="_blank" rel="noopener noreferrer">module federation examples</a> to Rspack and Rsbuild. One notable example is the CRA migration, which was seamless and took minutes to switch from CRA to Rsbuild <a href="https://github.com/module-federation/module-federation-examples/tree/master/cra" target="_blank" rel="noopener noreferrer">here</a>. This guide is also beneficial for CRA users seeking an easy performance boost for aging builds: <a href="/guide/migration/cra">Rsbuild Migration Guide</a>. Rsbuild has also been fantastic for <a href="https://rsbuild.rs/guide/migration/vue-cli" target="_blank" rel="noopener noreferrer">migrating Vue examples off vue-cli</a> and onto something faster, easier, and federation friendly.</p>
<h2 id="the-difference-between-federation-v1-and-v15">The difference between federation v1 and v1.5<a aria-hidden="true" href="#the-difference-between-federation-v1-and-v15">#</a></h2>
<p>Originally Federation was quite bare. RemoteEntry exposed <code>{get, init}</code> interface and not much else. This ended up being very limiting, but was simple. As complex uses grew and more capabilities were discovered, it became clear we needed more control beyond the initial idea of just sharing code between builds and loading it.</p>
<p>v1.5 introduces runtimePlugins. These can be added to compile time via <code>runtimePlugins</code> options. But you can also dynamically register them in javascript files at runtime too.</p>
<p>In Rspack:</p>
<pre><code>const { rspack } = require(&#39;@rspack/core&#39;);

new rspack.container.ModuleFederationPlugin({
  name: &#39;app1&#39;,
  filename: &#39;static/js/remoteEntry.js&#39;,
  exposes: {
    &#39;./Button&#39;: &#39;./src/components/button.js&#39;,
  },
  runtimePlugins: [require.resolve(&#39;./my-custom-plugin&#39;)]
  remotes: {
    app2: &#39;app2@http://localhost:3002/static/js/remoteEntry.js&#39;,
  },
  shared: {
    react: { singleton: true },
    &#39;react-dom&#39;: { singleton: true },
  },
})
</code></pre>
<p>And For Webpack:</p>
<pre><code>const { ModuleFederationPlugin } = require(&#39;@module-federation/enhanced&#39;);

new ModuleFederationPlugin({
  name: &#39;app1&#39;,
  filename: &#39;static/js/remoteEntry.js&#39;,
  exposes: {
    &#39;./Button&#39;: &#39;./src/components/button.js&#39;,
  },
  runtimePlugins: [require.resolve(&#39;./my-custom-plugin&#39;)]
  remotes: {
    app2: &#39;app2@http://localhost:3002/static/js/remoteEntry.js&#39;,
  },
  shared: {
    react: { singleton: true },
    &#39;react-dom&#39;: { singleton: true },
  },
})
</code></pre>
<p>Federation can also be used in a dynamic manner, without a compile-time plugin. You can read more about v1.5 runtime <a href="https://github.com/module-federation/universe/tree/feat/async-boundary-option/packages/runtime" target="_blank" rel="noopener noreferrer">here</a></p>
<pre><code>// Can load modules using only the runtime SDK without relying on build plugins
// When not using build plugins, shared dependencies cannot be automatically reused



init({
  name: &#39;app1&#39;,
  remotes: [
    {
      name: &#39;runtime_remote1&#39;,
      alias: &#39;app2&#39;,
      entry: &#39;http://localhost:3006/remoteEntry.js&#39;,
    },
  ],
  shared: {
    react: {
      version: &#39;18.2.0&#39;,
      scope: &#39;default&#39;,
      lib: () =&gt; React,
      shareConfig: {
        singleton: true,
        requiredVersion: &#39;&gt;17&#39;,
      },
    },
    &#39;react-dom&#39;: {
      version: &#39;18.2.0&#39;,
      scope: &#39;default&#39;,
      lib: () =&gt; ReactDOM,
      shareConfig: {
        singleton: true,
        requiredVersion: &#39;&gt;17&#39;,
      },
    },
  },
  plugins: [customPlugin()],
});

// Load by alias
loadRemote &lt;
  { add: (...args: Array&lt;number&gt;) =&gt; number } &gt;
  &#39;app2/util&#39;.then(md =&gt; {
    md.add(1, 2, 3);
  });
</code></pre>
<p>Read more about Federation 1.5 Update: <a href="https://github.com/module-federation/universe/discussions/1936" target="_blank" rel="noopener noreferrer">Module Federation 1.5</a></p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 0.4]]></title>
            <link>https://rspack.rs/blog/announcing-0-4</link>
            <guid>/blog/announcing-0-4</guid>
            <pubDate>Wed, 22 Nov 2023 17:31:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>November 02, 2023</em></p>
<h1 id="announcing-rspack-04">Announcing Rspack 0.4<a aria-hidden="true" href="#announcing-rspack-04">#</a></h1>
<h2 id="major-changes">Major changes<a aria-hidden="true" href="#major-changes">#</a></h2>
<h3 id="drop-nodejs-14-support">Drop Node.js 14 support<a aria-hidden="true" href="#drop-nodejs-14-support">#</a></h3>
<p>Rspack no longer supports Node.js 14, Node.js 16+ is now required.</p>
<h3 id="make-rspackcore-as-peer-dependency-of-rspackcli">Make @rspack/core as peer dependency of @rspack/cli<a aria-hidden="true" href="#make-rspackcore-as-peer-dependency-of-rspackcli">#</a></h3>
<p><code>@rspack/core</code> is now a peer dependency of <code>@rspack/cli</code> rather than a direct dependency. This means that you need to manually install <code>@rspack/core</code> with <code>@rspack/cli</code> now. aligning Rspack more closely with webpack. In the long term, the positioning of <code>@rspack/cli</code> will no longer be an out-of-the-box solution. We will align <code>@rspack/cli</code> with webpack-cli and may even directly support the use of <code>@rspack/core</code> in <code>webpack-cli</code>. We recommend <a href="https://rsbuild.rs/" target="_blank" rel="noopener noreferrer">Rsbuild</a> as an out-of-the-box solution.</p>
<h3 id="deprecating-default-transformation">Deprecating default transformation<a aria-hidden="true" href="#deprecating-default-transformation">#</a></h3>
<p><code>experiments.rspackFuture.disableTransformByDefault</code> is enabled by default in v0.4.0. For people that still need the legacy behavior, you may manually set this option to <code>false</code>.</p>
<p>This feature primarily addresses three categories of problems: <a href="https://v0.rspack.rs/config/builtins" target="_blank" rel="noopener noreferrer">builtins</a> code transformation features, <a href="/config/target">target</a>, and custom <a href="/config/module-rules#rulestype">rules[].type</a>.</p>
<ol>
<li>Removal of support for some <a href="https://v0.rspack.rs/config/builtins" target="_blank" rel="noopener noreferrer">builtins</a> features:</li>
</ol>
<ul>
<li><a href="https://v0.rspack.rs/config/builtins#builtinsrelay" target="_blank" rel="noopener noreferrer">builtins.relay</a>: moved to <code>rspackExperiments.relay</code></li>
<li><a href="https://v0.rspack.rs/config/builtins#builtinsreact" target="_blank" rel="noopener noreferrer">builtins.react</a>: moved to <code>jsc.transform.react</code></li>
<li><a href="https://v0.rspack.rs/config/builtins#builtinsemotion" target="_blank" rel="noopener noreferrer">builtins.emotion</a>: moved to <code>rspackExperiments.emotion</code></li>
<li><a href="https://v0.rspack.rs/config/builtins#builtinspluginimport" target="_blank" rel="noopener noreferrer">builtins.pluginImport</a>: moved to <code>rspackExperiments.import</code></li>
<li><a href="https://v0.rspack.rs/config/builtins#builtinsdecorator" target="_blank" rel="noopener noreferrer">builtins.decorator</a>: moved to <code>jsc.parser.decorators</code></li>
<li><a href="https://v0.rspack.rs/config/builtins#builtinspresetenv" target="_blank" rel="noopener noreferrer">builtins.presetEnv</a>: moved to <code>jsc.env</code></li>
</ul>
<pre><code meta="">export default {
  module: {
    rules: [
      {
        test: /\.jsx$/,
        loader: 'builtin:swc-loader',
        options: {
          jsc: {
            parser: {
              syntax: 'ecmascript',
              jsx: true,
            },
            transform: {
              react: {
                runtime: 'automatic',
              },
            },
          },
          rspackExperiments: {
            emotion: true, // The same as `builtins`
          },
        },
        type: 'javascript/auto',
      },
    ],
  },
  experiments: {
    rspackFuture: {
      disableTransformByDefault: true,
    },
  },
};
</code></pre>
<ol start="2">
<li><a href="/config/target">target</a> will not downgrade user-side code(including <code>node_modules</code>)</li>
</ol>
<pre><code meta="">export default {
  target: ["web", "es5"],
  module: {
    rules: [
      {
        test: /\.[cm]?js$/,
        exclude: /node_modules/,
        loader: 'builtin:swc-loader',
        options: {
          jsc: {
            parser: {
              syntax: "ecmascript"
            },
+           target: "es5" // Notice: `jsc.target` and `env` cannot be set at the same time.
          },
+        env: { //  Notice: `jsc.target` and `env` cannot be set at the same time.
+         targets: "chrome >= 48"
+        }
        }
        type: 'javascript/auto',
      },
    ],
  }
};
</code></pre>
<ol start="3">
<li>Removed non-webpack compatible <a href="/config/module-rules#rulestype">rules[].type</a></li>
</ol>
<p>These types have been removed:</p>
<ul>
<li><code>&quot;typescript&quot;</code></li>
<li><code>&quot;jsx&quot;</code></li>
<li><code>&quot;tsx&quot;</code></li>
</ul>
<p>For JS-related types, only the following will be retained:</p>
<ul>
<li><code>&quot;javascript/auto&quot;</code></li>
<li><code>&quot;javascript/esm&quot;</code></li>
<li><code>&quot;javascript/dynamic&quot;</code></li>
</ul>
<p>Refer to <a href="/config/experiments#experimentsrspackfuturedisabletransformbydefault">this</a> for the complete migration guide.</p>
<p>Check out our previous discussion <a href="https://github.com/web-infra-dev/rspack/discussions/4070" target="_blank" rel="noopener noreferrer">here</a>.</p>
<h3 id="deprecating-builtinreactrefresh">Deprecating builtin.react.refresh<a aria-hidden="true" href="#deprecating-builtinreactrefresh">#</a></h3>
<p>With <code>experiments.rspackFuture.disableTransformByDefault</code> is enabled by default in v0.4.0, <code>builtin.react.refresh</code> has also been deprecated. Now we recommend using <code>@rspack/plugin-react-refresh</code> to enable react fast refresh.</p>
<pre><code meta="">+ 

const isDev = process.env.NODE_ENV === 'development';

export default {
  mode: isDev ? 'development' : 'production',
  module: {
    rules: [
      {
        test: /\.jsx$/,
        use: {
          loader: 'builtin:swc-loader',
          options: {
            jsc: {
              parser: {
                syntax: 'ecmascript',
                jsx: true,
              },
              transform: {
                react: {
+                  development: isDev,
+                  refresh: isDev,
                },
              },
            },
          },
        },
      },
    ],
  },
-  builtins: {
-    react: {
-      refresh: true,
-    }
-  },
  plugins: [
+    isDev && new ReactRefreshRspackPlugin()
  ],
};
</code></pre>
<p>Checkout <a href="/guide/tech/react#fast-refresh">here</a> for more details.</p>
<h3 id="deprecating-builtinsass-loader">Deprecating builtin:sass-loader<a aria-hidden="true" href="#deprecating-builtinsass-loader">#</a></h3>
<p><code>builtin:sass-loader</code> has now been deprecated. If you are using it, migrate to <code>sass-loader</code>. Rspack will remove <code>builtin:sass-loader</code> in v0.5.0.</p>
<h3 id="deprecating-experimentsincrementalrebuild">Deprecating experiments.incrementalRebuild<a aria-hidden="true" href="#deprecating-experimentsincrementalrebuild">#</a></h3>
<p><code>experiments.incrementalRebuild</code> has now been deprecated. Rspack will remove it in v0.5.0.</p>
<h3 id="refactoring-export-api-in-rspackcore">Refactoring export API in @rspack/core<a aria-hidden="true" href="#refactoring-export-api-in-rspackcore">#</a></h3>
<p>Before, some APIs should not be exported accidentally exported through re-export from @rspack/core. Now with this refactor, we clean up the export APIs from @rspack/core.</p>
<p>This shouldn't break anything, but if you are using unintentionally exported APIs, this may break you, and you may be using Rspack in the hacky way.</p>
<p>If there is a real need for removed APIs from this refactor, please raise an issue in the Rspack repository.</p>
<h3 id="deprecating-builtinsdevfriendlysplitchunks-and-experimentsnewsplitchunks">Deprecating <code>builtins.devFriendlySplitChunks</code> and <code>experiments.newSplitChunks</code><a aria-hidden="true" href="#deprecating-builtinsdevfriendlysplitchunks-and-experimentsnewsplitchunks">#</a></h3>
<p>In order to full migrate to Webpack's split chunks implementation, these fields are deprecated. Rspack will remove these fields in v0.5.0.</p>
<h3 id="enable-newresolver-by-default">Enable newResolver by default<a aria-hidden="true" href="#enable-newresolver-by-default">#</a></h3>
<p>New resolver is now enabled by default.</p>
<p>The new resolver has passed all of <a href="https://www.npmjs.com/package/enhanced-resolve" target="_blank" rel="noopener noreferrer">enhanced-resolve</a>'s test suite. It is 5 times faster than previous implementation, and 28 times faster than enhanced-resolve.</p>
<p>The new resolver can be configured to read <code>tsconfig.json</code>'s <code>compilerOptions.paths</code> and <code>references</code> field and provides better support for nested path alias. See API <a href="/config/resolve#resolvetsconfig">resolve.tsConfig</a> for details.</p>
<p>To opt out of the new resolver, set <code>experiments.rspackFuture.newResolver</code> to <code>false</code>.</p>
<h2 id="migration-guide">Migration guide<a aria-hidden="true" href="#migration-guide">#</a></h2>
<p>There is a <a href="https://github.com/rstackjs/rstack-examples/pull/2" target="_blank" rel="noopener noreferrer">migrate example</a> demonstrating how to migrate from Rspack 0.3.14 to Rspack 0.4.0.</p>
<h3 id="choose-rspackcli-or-rsbuild">Choose <code>@rspack/cli</code> or <code>Rsbuild</code>?<a aria-hidden="true" href="#choose-rspackcli-or-rsbuild">#</a></h3>
<p>If your application is a CSR application, we strongly encourage you to use Rsbuild instead of configuring Rspack yourself, as Rsbuild is much easier to use compared to <code>@rspack/cli</code>.</p>
<h3 id="upgrade-nodejs-version">Upgrade Node.js version<a aria-hidden="true" href="#upgrade-nodejs-version">#</a></h3>
<p>Rspack no longer supports Node.js 14 as of version 0.4.0; Node.js 16+ is now required.</p>
<h3 id="install-rspackcore-manually-with-rspackcli">Install <code>@rspack/core</code> manually with <code>@rspack/cli</code><a aria-hidden="true" href="#install-rspackcore-manually-with-rspackcli">#</a></h3>
<pre><code meta="">{
  "devDependencies": {
+    "@rspack/core": "0.4.0",
     "@rspack/cli": "0.4.0"
  }
}
</code></pre>
<h3 id="use-builtinswc-loader-to-support-module-transformation">Use <code>builtin:swc-loader</code> to support module transformation<a aria-hidden="true" href="#use-builtinswc-loader-to-support-module-transformation">#</a></h3>
<p>Rspack no longer transforms files by default as of version 0.4.0, you can still enable old transform behavior by the following setting</p>
<pre><code>{
  experiments: {
    rspackFuture: {
      disableTransformByDefault: false; // set to old transform behavior
    }
  }
}
</code></pre>
<p>But we suggest you use <code>builtin:swc-loader</code> to transform files now. More details are available in <a href="#deprecating-default-transformation">Deprecating Default Transformation</a>.</p>
<h3 id="use-rspackplugin-react-refresh-for-react-applications">Use <code>@rspack/plugin-react-refresh</code> for React applications<a aria-hidden="true" href="#use-rspackplugin-react-refresh-for-react-applications">#</a></h3>
<p><code>builtin.react.refresh</code> does not work when we disable the default transformation, so you need to use <code>@rspack/plugin-react-refresh</code> to enable fast refresh. More details are available in <a href="#deprecating-builtinreactrefresh">Deprecating builtin.react.refresh</a>.</p>
<h3 id="migrating-builtin-options-to-builtin-plugins">Migrating builtin options to builtin plugins<a aria-hidden="true" href="#migrating-builtin-options-to-builtin-plugins">#</a></h3>
<p>In v0.4.0, Rspack deprecated some of the builtin options and migrated them to <a href="/config/plugins">builtin plugins</a>.</p>
<p>Currently, Rspack's internal plugins are divided into two categories:</p>
<ul>
<li>Plugins compatible with Webpack, such as DefinePlugin, ProvidePlugin, etc. This part has been fully aligned with webpack.</li>
<li>Rspack-specific plugins, such as SwcJsMinimizerRspackPlugin, CopyRspackPlugin, etc.</li>
</ul>
<p>The original <code>builtins.define</code> can be migrated as follows:</p>
<pre><code meta="">+ 

export default {
-  builtins: {
-    define: { process.env.NODE_ENV: JSON.stringify(process.env.NODE_ENV) }
-  },
+  plugins: [
+    new rspack.DefinePlugin({ process.env.NODE_ENV: JSON.stringify(process.env.NODE_ENV) })
+  ]
}
</code></pre>
<p>For <code>builtins.html</code>, it can be directly migrated to <a href="/plugins/rspack/html-rspack-plugin">HtmlRspackPlugin</a>:</p>
<pre><code meta="">+ 

export default {
-  builtins: {
-    html: [{ template: "./index.html" }]
-  },
+  plugins: [
+    new rspack.HtmlRspackPlugin({ template: "./index.html" })
+  ]
}
</code></pre>
<p>When there are multiple configurations in <code>builtins.html</code>, multiple plugin instances can be created:</p>
<pre><code meta="">

export default {
  plugins: [
    new rspack.HtmlRspackPlugin({ template: './index.html' }),
    new rspack.HtmlRspackPlugin({ template: './foo.html' }),
  ],
};
</code></pre>
<p>For <code>builtins.copy</code>, it can be directly migrated to <a href="/plugins/rspack/copy-rspack-plugin">CopyRspackPlugin</a>.</p>
<p>For the original <code>builtins.minifyOptions</code>, we provide <a href="/plugins/rspack/swc-js-minimizer-rspack-plugin">SwcJsMinimizerRspackPlugin</a>:</p>
<pre><code meta="">

export default {
  optimization: {
    minimizer: [
      new rspack.SwcJsMinimizerRspackPlugin({
        // minimizer configuration
      }),
    ],
  },
};
</code></pre>
<p>Other builtin options can be directly referred to the rspack <a href="/config/plugins">builtin plugins</a> for migration, or completed according to the CLI prompts after upgrading to v0.4.0.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 0.3]]></title>
            <link>https://rspack.rs/blog/announcing-0-3</link>
            <guid>/blog/announcing-0-3</guid>
            <pubDate>Thu, 24 Aug 2023 12:15:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>August 24, 2023</em></p>
<h1 id="announcing-rspack-03">Announcing Rspack 0.3<a aria-hidden="true" href="#announcing-rspack-03">#</a></h1>
<h2 id="breaking-changes">Breaking changes<a aria-hidden="true" href="#breaking-changes">#</a></h2>
<p>In version 0.3, Rspack aligns the default CSS handling behavior with webpack when set <code>experiments.css = true</code>. This involves removing many built-in CSS transformation logic, which introduces some breaking changes. If your application previously relied on these transformation logic, please pay attention to the migration steps below.</p>
<h3 id="removal-of-rspackpostcss-loader-and-builtinspostcss">Removal of @rspack/postcss-loader and builtins.postcss<a aria-hidden="true" href="#removal-of-rspackpostcss-loader-and-builtinspostcss">#</a></h3>
<p>Before Rspack fully supported <code>postcss-loader</code>, Rspack implemented <code>@rspack/postcss-loader</code> and built-in <code>builtins.postcss</code> to fulfill the functionality. Currently, Rspack fully supports <code>postcss-loader</code>, so we have decided to deprecate <code>@rspack/postcss-loader</code> and <code>builtins.postcss</code>. Users of <code>@rspack/postcss-loader</code> can seamlessly migrate to <code>postcss-loader</code>, while users that previously used Rspack's <code>builtins.postcss</code> for the <code>px2rem</code> conversion functionality can migrate to <code>postcss-loader</code> and <code>postcss-plugin-px2rem</code>. Here is the migration process:</p>
<p>• Before:</p>
<pre><code meta="">export default {
  builtins: {
    postcss: {
      pxtorem: {
        rootValue: 50,
      },
    },
  },
};
</code></pre>
<p>• After:</p>
<pre><code meta="">export default {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          {
            loader: 'postcss-loader',
            options: {
              postcssOptions: {
                plugins: [
                  [
                    'postcss-plugin-px2rem',
                    {
                      rootValue: 100,
                    },
                  ],
                ],
              },
            },
          },
        ],
      },
    ],
  },
};
</code></pre>
<h3 id="removal-of-built-in-css-autoprefixer-functionality">Removal of built-in CSS autoprefixer functionality<a aria-hidden="true" href="#removal-of-built-in-css-autoprefixer-functionality">#</a></h3>
<p>To align better with webpack's CSS handling, Rspack removes the built-in autoprefixer functionality in 0.3. You can use <code>postcss-loader</code> to achieve <code>autoprefixer</code>.</p>
<pre><code meta="">export default {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          {
            loader: 'postcss-loader',
            options: {
              postcssOptions: {
                plugins: [['autoprefixer']],
              },
            },
          },
        ],
        type: 'css',
      },
    ],
  },
};
</code></pre>
<p>You can refer to the <a href="https://github.com/rstackjs/rstack-examples/tree/main/rspack/postcss-loader" target="_blank" rel="noopener noreferrer">examples/postcss-loader</a> for a complete example.</p>
<h3 id="access-to-internal-modules-restricted">Access to internal modules restricted<a aria-hidden="true" href="#access-to-internal-modules-restricted">#</a></h3>
<p>Due to the current instability of the internal module API in Rspack, directly accessing the internal modules can easily lead to breaking changes. Therefore, Rspack restricts the ability to directly access internal modules and only supports accessing Rspack's API from the root module.</p>
<p>• Before:</p>
<pre><code> // not supported since 0.3
</code></pre>
<p>• After:</p>
<pre><code>
</code></pre>
<h2 id="major-feature-updates">Major feature updates<a aria-hidden="true" href="#major-feature-updates">#</a></h2>
<h3 id="web-workers-support">Web Workers support<a aria-hidden="true" href="#web-workers-support">#</a></h3>
<p>Rspack natively supports Web Workers, which means you can use Web Workers out of the box without using worker-loader. Here is how to use it:</p>
<pre><code>new Worker(new URL(&#39;./worker.js&#39;, import.meta.url));
new Worker(new URL(&#39;./worker.js&#39;, import.meta.url), {
  name: &#39;my-worker&#39;,
});
</code></pre>
<p>For more information about web workers support, see <a href="/guide/features/web-workers">web workers</a>.</p>
<h3 id="builtinswc-loader-support"><code>builtin:swc-loader</code> support<a aria-hidden="true" href="#builtinswc-loader-support">#</a></h3>
<p>Although Rspack provides many SWC compilation configuration options, these configurations are global and cannot fulfill the requirement of using different SWC transformation logic for different modules. Therefore, Rspack supports <code>builtin:swc-loader</code> to provide more fine-grained SWC transformation configuration. Compared to the JavaScript version of <code>swc-loader</code>, <code>builtin:swc-loader</code> has better performance. You can use <code>builtin:swc-loader</code> as follows:</p>
<pre><code meta="">

export default defineConfig({
  module: {
    rules: [
      {
        test: /\.jsx$/,
        use: {
          loader: 'builtin:swc-loader',
          options: {
            jsc: {
              parser: {
                syntax: 'ecmascript',
                jsx: true,
              },
              transform: {
                react: {
                  pragma: 'React.createElement',
                  pragmaFrag: 'React.Fragment',
                  throwIfNamespace: true,
                  development: false,
                },
              },
            },
          },
        },
        type: 'javascript/auto',
      },
    ],
  },
});
</code></pre>
<p>You can refer to <a href="https://github.com/rstackjs/rstack-examples/tree/main/rspack/builtin-swc-loader" target="_blank" rel="noopener noreferrer">examples/builtin-swc-loader</a> for more examples. Currently, <code>builtin:swc-loader</code> still has limitations, such as not supporting Wasm plugins, etc. Rspack will continue to iterate and support more features of <code>builtin:swc-loader</code> in future versions.</p>
<h3 id="improved-profile-support">Improved profile support<a aria-hidden="true" href="#improved-profile-support">#</a></h3>
<p>Performance optimization is a common requirement in business support. To reduce the cost of performance optimization for businesses, we have improved the experience of Rspack Profile. You can generate profile-related files for performance optimization by using the RSPACK_PROFILE environment variable.</p>
<pre><code>$ RSPACK_PROFILE=ALL rspack build
</code></pre>
<p>For more detailed information about Profile, see <a href="/guide/optimization/profile">Performance Profiling</a>.</p>
<p>Alignment with More APIs</p>
<ul>
<li><code>splitChunks.chunks</code> supports regex.</li>
<li>Supports <code>splitChunk.\{cacheGroup\}.type</code>.</li>
<li>Supports <code>splitChunk.\{cacheGroup\}.idHint</code>.</li>
<li>Supports <code>ensureChunkConditionsPlugin</code>.</li>
<li><code>rules[].use</code> supports functions.</li>
<li>Supports <code>configuration.profile</code>.</li>
</ul>
<h3 id="more-hook-and-plugin-support">More hook and plugin support<a aria-hidden="true" href="#more-hook-and-plugin-support">#</a></h3>
<p>Compared to version 0.2, we have implemented more plugin APIs and made compatibility improvements for more plugins in version 0.3. At the same time, we have refined the plugin API support progress of webpack, making the support progress of plugin APIs transparent. You can track the implementation progress of plugin APIs here: <a href="https://github.com/orgs/web-infra-dev/projects/9" target="_blank" rel="noopener noreferrer">plugin-api-progress</a>.</p>
<h3 id="alignment-with-webpack-architecture">Alignment with webpack architecture<a aria-hidden="true" href="#alignment-with-webpack-architecture">#</a></h3>
<p>In version 0.3, we have further optimized the alignment with the webpack architecture, migrating from the original AST-based codegen architecture to the string transformation-based architecture. This alignment work further ensures that Rspack can align with more Hook APIs of webpack during the codegen stage to be compatible with more community plugins.</p>
<h3 id="rspack-ecosystem">Rspack ecosystem<a aria-hidden="true" href="#rspack-ecosystem">#</a></h3>
<p>Starting from version 0.2, Rspack provides support for vue-loader. However, creating a complete Vue.js CLI solution based on vue-loader can be a complex task. To simplify the development of Vue.js applications using Rspack, we offer the <a href="https://rsbuild.rs/" target="_blank" rel="noopener noreferrer">Rsbuild</a>, which is an out-of-the-box solution. This solution helps developers easily develop Vue.js applications using Rspack.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 0.2]]></title>
            <link>https://rspack.rs/blog/announcing-0-2</link>
            <guid>/blog/announcing-0-2</guid>
            <pubDate>Fri, 02 Jun 2023 13:11:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>June 02, 2023</em></p>
<h1 id="announcing-rspack-02">Announcing Rspack 0.2<a aria-hidden="true" href="#announcing-rspack-02">#</a></h1>
<p>It has been almost three months since the release of Rspack 0.1. We have received so much attention and feedback from the community, and we are grateful.</p>
<p>In version 0.2, we have added many features, such as: realContentHash, DataURI, support for ESM format, strengthened compatibility with webpack, and optimized many details. In addition, thanks to compatibility with the webpack API, we have also further achieved compatibility with the surrounding ecosystem. Completing tests for compatibility with vue-loader versions 17 (corresponding to Vue 3) and 15 (corresponding to Vue 2). You can now try using Rspack in Vue 2/3 projects.</p>
<p>We look forward to you experiencing these new improvements in version 0.2, and welcome your feedback.</p>
<h2 id="main-feature-updates">Main feature updates<a aria-hidden="true" href="#main-feature-updates">#</a></h2>
<h3 id="loader">Loader<a aria-hidden="true" href="#loader">#</a></h3>
<p>Version 0.2 has completed compatibility with most of the loader APIs, including: inline match resource, pitching loader, and inline loader. More APIs have further improved compatibility with webpack loaders, details of which can be found in our webpack compatibility updates <a href="/api/loader-api/index">Loader API</a>.</p>
<h3 id="plugin-hooks">Plugin hooks<a aria-hidden="true" href="#plugin-hooks">#</a></h3>
<p>New hooks for plugins have been added.</p>
<p>Compiler hooks:</p>
<ol>
<li><a href="/api/plugin-api/compiler-hooks#beforecompile">beforeCompile</a></li>
<li><a href="/api/plugin-api/compiler-hooks#aftercompile">afterCompile</a></li>
</ol>
<p>Compilation hooks:</p>
<ol>
<li><a href="/api/plugin-api/compilation-hooks#optimizemodules">optimizeModules</a></li>
<li><a href="/api/plugin-api/compilation-hooks#optimizechunkmodules">optimizeChunkModule</a></li>
<li><a href="/api/plugin-api/compilation-hooks#finishmodules">finishModules</a></li>
<li><a href="/api/plugin-api/compilation-hooks#chunkasset">chunkAsset</a></li>
</ol>
<p>NormalModuleFactory hooks:</p>
<ol>
<li><a href="/api/plugin-api/normal-module-factory-hooks#beforeresolve">beforeResolve</a></li>
<li><a href="/api/plugin-api/normal-module-factory-hooks#afterresolve">afterResolve</a></li>
<li><a href="/api/plugin-api/normal-module-factory-hooks#resolveforscheme">ResolveForScheme</a></li>
</ol>
<p>ContextModuleFactory hooks:</p>
<ol>
<li><a href="/api/plugin-api/context-module-factory-hooks#beforeresolve">beforeResolve</a></li>
</ol>
<h3 id="realcontenthash">realContentHash<a aria-hidden="true" href="#realcontenthash">#</a></h3>
<p>We have implemented optimization.realContentHash, which calculates the Hash based on the final product's file content. This makes the generated Hash more stable and is better utilized for caching. In version 0.2, this feature will be enabled by default for production environment builds.</p>
<h3 id="esmsystem-format">ESM/System format<a aria-hidden="true" href="#esmsystem-format">#</a></h3>
<p>In the new version, System/ESM products can be generated, and the configuration for outputting ESM products is as follows:</p>
<pre><code meta="">export default {
  // …
  experiments: {
    outputModule: true,
  },
  output: {
    chunkFormat: 'module',
    chunkLoading: 'import',
    library: {
      type: 'module',
    },
  },
};
</code></pre>
<h3 id="new-splitchunksplugin-implementation">New <code>SplitChunksPlugin</code> implementation<a aria-hidden="true" href="#new-splitchunksplugin-implementation">#</a></h3>
<p>We have restructured the existing implementation of <code>SplitChunksPlugin</code> in Rspack, making the behavior of <code>SplitChunksPlugin</code> more predictable and reducing the cost of troubleshooting related issues.</p>
<p>After the restructuring, we are confident to implement more features on SplitChunksPlugin. We are pleased to announce that in version 0.2, SplitChunksPlugin supports the following configuration options:</p>
<ul>
<li><code>splitChunks.maxSize</code></li>
<li><code>splitChunks.maxAsyncSize</code></li>
<li><code>splitChunks.maxInitialSize</code></li>
<li><code>splitChunks.maxAsyncRequests</code></li>
<li><code>splitChunks.maxInitialRequests</code></li>
</ul>
<p>In version 0.2, we will use the new <code>SplitChunksPlugin</code> by default. If you encounter problems, please provide feedback promptly, and we will fix them as soon as possible. You can switch back to the deprecated implementation by using the <code>experiments.newSplitChunks: false</code> option, but we strongly recommend using the new version. In version 0.3, we will remove the deprecated implementation.</p>
<h3 id="datauri-support">DataURI support<a aria-hidden="true" href="#datauri-support">#</a></h3>
<p>We have implemented support for DataURI. Now you can write the following code to implement virtual modules:</p>
<pre><code>
</code></pre>
<p>In addition, we have supported <code>mimetype</code> and <code>scheme</code> as two types of module rule conditions. For example, you can make resources with <code>scheme</code> as <code>&#39;data&#39;</code> no longer treated as inline processing, but as separate resource files through the following method:</p>
<pre><code meta="">export default {
  module: {
    rules: [
      {
        scheme: 'data',
        type: 'asset/resource',
      },
    ],
  },
};
</code></pre>
<h2 id="breaking-changes">Breaking changes<a aria-hidden="true" href="#breaking-changes">#</a></h2>
<ul>
<li>
<p>Alignment of Filename Generation Logic</p>
<p>In version 0.1.12, we further aligned the file name generation logic with webpack, and refactored the implementation of file name generation. However, the [ext] in <code>output.filename</code>, <code>output.chunkFilename</code>, <code>output.cssFilename</code>, and <code>output.cssChunkFilename</code> will no longer be replaced. This behavior is now consistent with webpack but is a breaking change for versions of Rspack prior to 0.1.12. If you used [ext] in the above 4 filename configurations, you need to change it to the corresponding <code>.js</code> or <code>.css</code>, for example:</p>
<pre><code meta="">export default {
  output: {
-    filename: "[name][ext]",
+    filename: "[name].js",

-    chunkFilename: "async/[name][ext]",
+    chunkFilename: "async/[name].js",

-    cssFilename: "[name][ext]",
+    cssFilename: "[name].css",

-    cssChunkFilename: "async/[name][ext]",
+    cssChunkFilename: "async/[name].css",
  }
}
</code></pre>
<p>Details: <a href="https://github.com/web-infra-dev/rspack/issues/3270" target="_blank" rel="noopener noreferrer">https://github.com/web-infra-dev/rspack/issues/3270</a></p>
</li>
<li>
<p>Enabled realContentHash by default in production</p>
<p>Details: <a href="https://github.com/web-infra-dev/rspack/pull/3338" target="_blank" rel="noopener noreferrer">https://github.com/web-infra-dev/rspack/pull/3338</a></p>
</li>
<li>
<p>Modified the Extensions of Resolve</p>
<p>Details: <a href="https://github.com/web-infra-dev/rspack/pull/3242" target="_blank" rel="noopener noreferrer">https://github.com/web-infra-dev/rspack/pull/3242</a></p>
</li>
<li>
<p>Modified the Export Method of @rspack/dev-middleware and @rspack/html-plugin, and Removed <code>getRspackMemoryAssets</code> Exported by @rspack/dev-middleware</p>
<p>Details: <a href="https://github.com/web-infra-dev/rspack/pull/3358" target="_blank" rel="noopener noreferrer">https://github.com/web-infra-dev/rspack/pull/3358</a></p>
</li>
</ul>
<h2 id="webpack-compatibility-updates">Webpack compatibility updates<a aria-hidden="true" href="#webpack-compatibility-updates">#</a></h2>
<p>As we support more webpack APIs, we are also compatible with more community plugins and loaders. We have adapted some plugins and loaders that have a high demand in the community.</p>
<h3 id="fork-ts-checker-webpack-plugin">fork-ts-checker-webpack-plugin<a aria-hidden="true" href="#fork-ts-checker-webpack-plugin">#</a></h3>
<p>Type checking in TypeScript for Rspack is highly demanded. Rspack has fully adapted <a href="https://github.com/TypeStrong/fork-ts-checker-webpack-plugin" target="_blank" rel="noopener noreferrer">fork-ts-checker-webpack-plugin</a>. You can use this plugin to perform TypeScript type checking during compilation. However, as TypeScript's type checking is usually very time-consuming, this makes the time required for type checking on larger projects may far exceed the build time of Rspack itself. In dev mode, this plugin will not block the build, but in build mode, this plugin will block the build. Please choose whether to enable this plugin based on your actual needs.</p>
<h3 id="license-webpack-plugin">license-webpack-plugin<a aria-hidden="true" href="#license-webpack-plugin">#</a></h3>
<p>A widely reported community demand is support for extracting licenses from code. Now, Rspack can achieve the requirement of extracting licenses from the code through <a href="https://github.com/xz64/license-webpack-plugin" target="_blank" rel="noopener noreferrer">license-webpack-plugin</a>.</p>
<h3 id="style-loader--css-loader">style-loader & css-loader<a aria-hidden="true" href="#style-loader--css-loader">#</a></h3>
<p>Although Rspack supports and enables the <code>experiments.css</code> feature of webpack by default, there are still many communities that strongly depend on <a href="https://github.com/webpack/style-loader" target="_blank" rel="noopener noreferrer">style-loader</a> & <a href="https://github.com/webpack/css-loader" target="_blank" rel="noopener noreferrer">css-loader</a>. We have completed support for style-loader and css-loader in 0.2.0, which also allows us to better adapt to frameworks such as Svelte and Vue.</p>
<h3 id="node-loader">node-loader<a aria-hidden="true" href="#node-loader">#</a></h3>
<p>When using Rspack to package Node applications like NestJS, a common requirement is to package libraries containing addons. These libraries' native dependencies cannot be directly packaged into js, so they need special treatment. Rspack has adapted <a href="https://github.com/webpack-contrib/node-loader" target="_blank" rel="noopener noreferrer">node-loader</a>, so you can now use Rspack to build node applications.</p>
<p>Rspack has additional adaptation of webpack's plugins. We have tracked the adapted plugins and loaders in <a href="https://github.com/rstackjs/rstack-examples/tree/main/rspack/loader-compat" target="_blank" rel="noopener noreferrer">loader-compat</a> and <a href="https://github.com/rstackjs/rstack-examples/tree/main/rspack/plugin" target="_blank" rel="noopener noreferrer">plugin-compat</a>. If you find that a community plugin or loader you are using is also compatible, welcome to submit it to us so we can list it in our compatibility matrix.</p>
<h2 id="framework-ecosystem-updates">Framework ecosystem updates<a aria-hidden="true" href="#framework-ecosystem-updates">#</a></h2>
<h3 id="modernjs-framework">Modern.js Framework<a aria-hidden="true" href="#modernjs-framework">#</a></h3>
<p>Thanks to the close collaboration and parallel iteration of the <a href="https://modernjs.dev/en/" target="_blank" rel="noopener noreferrer">Modern.js framework</a> and Rspack, <strong>Modern.js Rspack mode has covered 85% of the framework's capabilities</strong>, supporting SSR, BFF, micro front-end scenarios, and aligning with TypeScript type checking, code compatibility detection and other features.</p>
<p>At ByteDance, more than 80 projects are using the Modern.js Rspack mode. Some of the projects have been deployed into production and have seen a 10x improvement in build performance.</p>
<h3 id="modernjs-doc">Modern.js Doc<a aria-hidden="true" href="#modernjs-doc">#</a></h3>
<p>In addition to the Modern.js framework, the document site solution under the Modern.js system - <a href="https://modernjs.dev/doc-tools/" target="_blank" rel="noopener noreferrer">Modern.js Doc</a> - has also switched the bundler from webpack to Rspack, and rewritten the MDX compilation process based on Rust.</p>
<p>Compared to previous versions using webpack, the current version's build speed can be reduced to seconds. Using the Modern.js official website documentation as an example, the project's startup and build time has been reduced from 30 seconds to less than 2 seconds. In the future, we plan to rename Modern.js Doc to <strong>Rspress</strong> as the official documentation site solution for Rspack and maintain it through a separate repository.</p>
<blockquote>
<p>Welcome to visit the <a href="https://github.com/web-infra-dev/modern.js" target="_blank" rel="noopener noreferrer">Modern.js code repository</a> and experience the above content.</p>
</blockquote>
<h3 id="vue">Vue<a aria-hidden="true" href="#vue">#</a></h3>
<p>Rspack 0.2 has achieved compatibility with vue-loader! For Vue 3 projects, you can use Rspack's native CSS and TS processors to improve the compilation speed of Vue projects. All you need to do is upgrade vue-loader to version 17.2.2 or above and set <code>experimentalInlineMatchResource: true</code>. For more information on Vue 3/Vue 2 support, please refer to <a href="/guide/tech/vue">guide-vue</a>.</p>
<h3 id="svelte">Svelte<a aria-hidden="true" href="#svelte">#</a></h3>
<p>Thanks to Rspack's excellent support for the Loader API and the excellent design of <a href="https://github.com/sveltejs/svelte-loader" target="_blank" rel="noopener noreferrer">svelte-loader</a>, Rspack has fully adapted <a href="https://github.com/sveltejs/svelte-loader" target="_blank" rel="noopener noreferrer">svelte-loader</a>. Therefore, you can directly use <a href="https://github.com/sveltejs/svelte-loader" target="_blank" rel="noopener noreferrer">svelte-loader</a> in Rspack for svelte application development. You can refer to <a href="https://github.com/rstackjs/rstack-examples/tree/main/rspack/svelte" target="_blank" rel="noopener noreferrer">example-svelte</a> to complete the svelte-loader related configuration.</p>
<h3 id="storybook">Storybook<a aria-hidden="true" href="#storybook">#</a></h3>
<p>With the help of the Storybook team, Rspack has completed support for the Storybook React version. You can follow the <a href="/guide/migration/storybook.html">migrate Storybook</a> method to migrate from the webpack version to the Rspack version. In actual projects, tests have shown that the Rspack version is 5-10 times faster than the webpack version when the docgen feature is not turned on. When docgen is turned on, since Rspack still relies on babel to handle docgen, the performance is affected, but there is still a 2-3 times improvement.</p>
<h3 id="angular">Angular<a aria-hidden="true" href="#angular">#</a></h3>
<p>With the help of the <a href="https://valor-software.com/" target="_blank" rel="noopener noreferrer">Valor</a> team, Rspack has completed preliminary support for Angular. You can use Rspack to build Angular applications, but the support for dev and HMR has not yet been fully adapted. We will continue to follow up on Angular support in version 0.2.x.</p>
<h3 id="nestjs">NestJS<a aria-hidden="true" href="#nestjs">#</a></h3>
<p>With the help of <a href="https://rosa.be/" target="_blank" rel="noopener noreferrer">Rosa</a>, <a href="https://nx.dev/" target="_blank" rel="noopener noreferrer">Nx</a>, and <a href="https://valor-software.com/" target="_blank" rel="noopener noreferrer">Valor</a>, Rspack has completed the compilation support for <a href="https://nestjs.com/" target="_blank" rel="noopener noreferrer">NestJS</a>. You can use Rspack to package NestJS applications, and in actual projects, tests have shown that Rspack has a 5-10 times build performance improvement compared to the webpack version.</p>
<h2 id="dev-guide">Dev guide<a aria-hidden="true" href="#dev-guide">#</a></h2>
<p>The Rspack team cherishes the valuable contributions made by the open source community and wants to actively fosters collaboration. We are committed to maintaining an open approach, striving to engage and involve the community at every step.</p>
<p>This is why we are currently crafting a comprehensive development guide that equips contributors with all the essential materials required to facilitate the development of Rspack.</p>
<p>The current version of the guide contains all the necessary materials for building, testing, debugging, and profiling Rspack. Additionally, it includes contribution procedures, such as creating a minimal reproducible example.
In the future, the guide will offer an insightful overview of Rspack's architecture, enabling contributors to gain a profound understanding of the project's intricate inner workings.</p>
<h2 id="test-infrastructures">Test infrastructures<a aria-hidden="true" href="#test-infrastructures">#</a></h2>
<p>In order to ship with confidence, we are currently:</p>
<ul>
<li>Building and testing a list of examples in the Rspack repository (currently 38 examples)</li>
<li>Porting all webpack tests from the webpack repository</li>
<li>Running all tests on Node 14, 16 and 18</li>
<li>Maintaining a separate ecosystem-ci repository for integration tests</li>
</ul>
<h2 id="nightly-release">Nightly release<a aria-hidden="true" href="#nightly-release">#</a></h2>
<p>In order to expedite iteration, Rspack is released daily with the "@nightly" tag to npm.</p>
<h2 id="acknowledgements">Acknowledgements<a aria-hidden="true" href="#acknowledgements">#</a></h2>
<p>With the release of Rspack 0.2, we wholeheartedly thank all the contributors who have put effort into this version.</p>
<p>Special thanks to:</p>
<ul>
<li><a href="https://github.com/TheLarkInn" target="_blank" rel="noopener noreferrer">@TheLarkInn</a> and <a href="https://github.com/alexander-akait" target="_blank" rel="noopener noreferrer">@alexander-akait</a>, for answering and resolving many of Rspack team's questions about Webpack.</li>
<li><a href="https://github.com/zackarychapple" target="_blank" rel="noopener noreferrer">@zackarychapple</a>, <a href="https://github.com/valorkin" target="_blank" rel="noopener noreferrer">@valorkin</a>, <a href="https://github.com/edusperoni" target="_blank" rel="noopener noreferrer">@edusperoni</a>, and <a href="https://github.com/Coly010" target="_blank" rel="noopener noreferrer">@Coly101</a> for assisting the Rspack team with basic support for Angular and <a href="https://github.com/zackarychapple" target="_blank" rel="noopener noreferrer">@zackarychapple</a> for reviewing this release blog.</li>
<li><a href="https://github.com/suxin2017" target="_blank" rel="noopener noreferrer">@suxin2017</a>, for supporting System.js format and optional-dependency functionality in Rspack, as well as contributing a lot in terms of Windows compatibility.</li>
<li><a href="https://github.com/faga295" target="_blank" rel="noopener noreferrer">@faga295</a>, for supporting the decompression code comment feature and rspack preview feature in Rspack.</li>
<li><a href="https://github.com/lippzhang" target="_blank" rel="noopener noreferrer">@lippzhang</a>, for making numerous contributions in aligning Rspack's behavior with Webpack.</li>
<li><a href="https://github.com/HerringtonDarkholme" target="_blank" rel="noopener noreferrer">@HerringtonDarkholme</a>, for allowing Rspack to use rspack.config.ts as a configuration file.</li>
<li><a href="https://github.com/dhruvkelawala" target="_blank" rel="noopener noreferrer">@dhruvkelawala</a>, for implementing the builtins.provide feature in Rspack.</li>
<li><a href="https://github.com/magic-akari" target="_blank" rel="noopener noreferrer">@magic-akari</a>, for supporting the <code>new URL(&quot;./foo&quot;, import.meta.url)</code> syntax in Rspack.</li>
<li><a href="https://github.com/tuchg" target="_blank" rel="noopener noreferrer">@tuchg</a>, for supporting the packing of .wasm files in Rspack.</li>
</ul>
<p>We also want to thank all the users of Rspack, for showing trust in such a young open-source project. Your valuable feedback plays a key role in our project improvements and optimizations. Your support and trust is our motivation to move forward.</p>
<p>Finally, let us collectively celebrate the release of Rspack 0.2 and look forward to future developments and more opportunities for collaboration. Thanks again to all friends who support and pay attention to Rspack!</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 0.1]]></title>
            <link>https://rspack.rs/blog/announcing-0-1</link>
            <guid>/blog/announcing-0-1</guid>
            <pubDate>Mon, 06 Mar 2023 21:37:00 GMT</pubDate>
            <content:encoded><![CDATA[<p><em>March 06, 2023</em></p>
<h1 id="announcing-rspack-01">Announcing Rspack 0.1<a aria-hidden="true" href="#announcing-rspack-01">#</a></h1>
<p>Today we are so thrilled to announce that Rspack is officially released! Rspack is a Rust-based JavaScript bundler developed by the ByteDance Web Infra team that has features including high-performance, webpack interoperability, flexible configuration etc. Rspack has solved many problems in our scenarios and improved the developer experience for JavaScript engineers. To help more people get involved in this exciting project, we decided to open source this project. You are welcomed to create a pull request or issue.</p>
<h2 id="why-rspack">Why Rspack?<a aria-hidden="true" href="#why-rspack">#</a></h2>
<p>There are a lot of giant JavaScript applications inside ByteDance. They have very complex build configurations/scripts which may cost ten minutes to half an hour. We have tried so many ways to improve the build performance, but all existing solutions in the world lead to some other issues while solving some of them. After tons of work, we understand the requirements for a bundler are:</p>
<ul>
<li>Dev startup performance. <code>npm run dev</code> is a daily script for developers that may run many times. Reducing the cost of them to one minute from ten minutes is really life-saving.</li>
<li>Build performance. <code>npm run build</code> is common in CI/CD environments and determines the efficiency of launch. Many giant applications in ByteDance are built in 20 ~ 30 minutes. If we can reduce it to 3~5 minutes, developers will be really productive.</li>
<li>Flexible configuration. Giant projects always have complex configurations and can't be standardized. Back in time, we migrated some of the projects to other build tools to improve build performance, and the hardest part is changing the configuration.</li>
<li>Production optimization. We tried various solutions in the community and webpack gave the best result in production optimization like chunk-splitting, tree-shaking, etc. A better chunk strategy can help web apps get better metrics performance.</li>
</ul>
<p>In conclusion, we decided to build our own bundler, which is <code>Rspack</code>.</p>
<h2 id="how-is-rspack-doing-now">How is Rspack doing now?<a aria-hidden="true" href="#how-is-rspack-doing-now">#</a></h2>
<p>The Rspack project started about 11 months ago. Although it's still in the early stages, it can bring 5~10 times improvement to applications' build scripts. The metrics can be better when we finish all the optimizations.</p>
<p>Rspack has completed the architecture of webpack loader. It means you can use all kinds of loaders in the community, such as <code>babel-loader</code>, <code>less-loader</code>, <code>svgr</code> etc. We are planning to support all features of loader in Rspack. By that time, you can use loaders which haven't been supported for now, such as <code>vue-loader</code>.</p>
<p>Rspack currently only supports memory cache. Persistent and portable cache will be added in the future. We are working on a build system that can make cache shareable between two devices or environments. And Rspack will help accomplish that.</p>
<p>Rspack is now available in all frameworks inside ByteDance, and we are trying to collaborate with all friends in the community. Just like webpack, Rspack is an infrastructure for JavaScript ecosystems, which means that frameworks and Rspack can be beneficial for each other.</p>
<h2 id="acknowledgement">Acknowledgement<a aria-hidden="true" href="#acknowledgement">#</a></h2>
<p>Rspack can not be shipped today without the inspiration and support of various projects in the community. We would like to show our respect to these predecessors:</p>
<ul>
<li><a href="https://webpack.js.org/" target="_blank" rel="noopener noreferrer">The webpack team and community</a> for creating a great bundler and ecosystem from which we draw a lot of inspiration.</li>
<li><a href="https://github.com/sokra" target="_blank" rel="noopener noreferrer">@sokra</a> for the great work on the <a href="https://github.com/webpack/webpack" target="_blank" rel="noopener noreferrer">webpack</a> project.</li>
<li><a href="https://github.com/ScriptedAlchemy" target="_blank" rel="noopener noreferrer">@ScriptedAlchemy</a> for creating Module Federation and helping Rspack connect with the community.</li>
<li>The <a href="https://github.com/swc-project/swc" target="_blank" rel="noopener noreferrer">SWC</a> project created by <a href="https://github.com/kdy1" target="_blank" rel="noopener noreferrer">@kdy1</a>, which powers Rspack's code parsing, transformation and minification.</li>
<li>The <a href="https://github.com/evanw/esbuild" target="_blank" rel="noopener noreferrer">esbuild</a> project created by <a href="https://github.com/evanw" target="_blank" rel="noopener noreferrer">@evanw</a>, which inspired the concurrent architecture of Rspack.</li>
<li>The <a href="https://github.com/napi-rs/napi-rs" target="_blank" rel="noopener noreferrer">NAPI-RS</a> project created by <a href="https://github.com/Brooooooklyn" target="_blank" rel="noopener noreferrer">@Brooooooklyn</a>, which powers Rspack's node-binding implementation.</li>
<li>The <a href="https://github.com/parcel-bundler/parcel" target="_blank" rel="noopener noreferrer">Parcel</a> project created by <a href="https://github.com/devongovett" target="_blank" rel="noopener noreferrer">@devongovett</a> which is the pioneer of rust bundler and inspired Rspack's incremental rebuild design.</li>
<li>The <a href="https://github.com/vitejs/vite" target="_blank" rel="noopener noreferrer">Vite</a> project created by <a href="https://github.com/yyx990803" target="_blank" rel="noopener noreferrer">Evan You</a> which inspired Rspack's compatibility design of webpack's ecosystem.</li>
<li>The <a href="https://github.com/rolldown-rs/rolldown" target="_blank" rel="noopener noreferrer">Rolldown</a> project created by <a href="https://github.com/sponsors/rolldown-rs" target="_blank" rel="noopener noreferrer">Rolldown team</a>, which explores the possibility of making a performant bundler in Rust with Rollup-compatible API. It inspires the design principles of Rspack.</li>
<li>The <a href="https://github.com/jantimon/html-webpack-plugin" target="_blank" rel="noopener noreferrer">html-webpack-plugin</a> project created by <a href="https://github.com/jantimon" target="_blank" rel="noopener noreferrer">@jantimon</a>, <code>@rspack/html-plugin</code> is a fork of <a href="https://github.com/jantimon/html-webpack-plugin" target="_blank" rel="noopener noreferrer">html-webpack-plugin</a> to avoid some webpack API usage not supported in Rspack.</li>
<li>The <a href="https://github.com/vercel/turbo" target="_blank" rel="noopener noreferrer">Turbopack</a> project which inspired the ast path logic of Rspack.</li>
</ul>
<h2 id="future-plans">Future plans<a aria-hidden="true" href="#future-plans">#</a></h2>
<h3 id="improve-basic-capabilities">Improve basic capabilities<a aria-hidden="true" href="#improve-basic-capabilities">#</a></h3>
<p>Keep building Rspack will be our top priority. Compared with webpack, Rspack is still a baby, lacking complex features. Please keep sending us feedback on feature requests. We will finish them step by step.</p>
<h3 id="working-with-community-partners">Working with community partners<a aria-hidden="true" href="#working-with-community-partners">#</a></h3>
<p>We would love to offer some help with Rspack integration in your framework. If you are an engineer maintaining a framework who happens to be interested in giving Rspack a try, please contact us.
We have also established a partnership with the webpack team. Rspack is an attempt to optimize webpack performance using Rust, and in the future, we will explore more possibilities for optimizing webpack together with the webpack team. When Rspack reaches a certain level of maturity, webpack will attempt to integrate Rspack into webpack with experiments flag.</p>
<h3 id="improve-plugin-capabilities">Improve plugin capabilities<a aria-hidden="true" href="#improve-plugin-capabilities">#</a></h3>
<p>Rspack has supported most of the loader APIs, but only a few plugin APIs. There are two reasons why we haven't supported them all. One is that some APIs are bad for performance, so we didn't explore them for developers. And the other reason is simply lack of time, so you can create a merge request to help us.</p>
<p>A high performance plugin system is under discussion. It may be shipped out someday. Hopefully it can help developers get shorter build time while accessing a flexible configuration.</p>
<h3 id="continuously-improve-performance">Continuously improve performance<a aria-hidden="true" href="#continuously-improve-performance">#</a></h3>
<p>Currently, Rspack is a project with performance as the core selling point, so in the future we will do a lot of things to maintain this feature, such as improving the performance observation lab and doing a good job of performance prevention; using concurrent/multi-core friendly algorithms in more scenarios; developing a caching system that can be shared across platforms; optimizing memory usage and consumption, etc.</p>
<h3 id="build-a-quality-assurance-system">Build a quality assurance system<a aria-hidden="true" href="#build-a-quality-assurance-system">#</a></h3>
<p>Webpack has already accumulated very rich test cases, and in the future Rspack will reuse the existing test cases of webpack to improve its code coverage. Build a better CI system, and build an Ecosystem CI system with community projects to ensure that project upgrades do not cause breaks on upstream projects, to ensure long-term project health, and to ensure long-term increase in test coverage.</p>
<h2 id="trial">Trial<a aria-hidden="true" href="#trial">#</a></h2>
<ul>
<li>Quick start: <a href="/guide/start/quick-start">rspack.rs</a></li>
<li>GitHub Repo: <a href="https://github.com/web-infra-dev/rspack" target="_blank" rel="noopener noreferrer">github.com/web-infra-dev/rspack</a></li>
</ul>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Overview]]></title>
            <link>https://rspack.rs/blog/</link>
            <guid>/blog/</guid>
            <content:encoded><![CDATA[<h1 id="rspack-blogs">Rspack blogs<a aria-hidden="true" href="#rspack-blogs">#</a></h1>
<p>Check here for the latest articles and release announcements about Rspack.</p>
<h2 id="announcing-rspack-17"><a href="/blog/announcing-1-7">Announcing Rspack 1.7</a><a aria-hidden="true" href="#announcing-rspack-17">#</a></h2>
<blockquote>
<p>December 31, 2025</p>
</blockquote>
<p>Rspack 1.7 has been released, improving SWC Wasm plugin compatibility, importing assets as bytes, and stabilizing multiple experimental features.</p>
<h2 id="announcing-rspack-16"><a href="/blog/announcing-1-6">Announcing Rspack 1.6</a><a aria-hidden="true" href="#announcing-rspack-16">#</a></h2>
<blockquote>
<p>October 30, 2025</p>
</blockquote>
<p>Rspack 1.6 has been released with better ESM output, enhanced tree shaking, support for the import defer syntax, stabilized layers feature, and default barrel file optimization.</p>
<h2 id="announcing-rspack-15"><a href="/blog/announcing-1-5">Announcing Rspack 1.5</a><a aria-hidden="true" href="#announcing-rspack-15">#</a></h2>
<blockquote>
<p>August 26, 2025</p>
</blockquote>
<p>Rspack 1.5 has been released, introducing barrel file optimization and constant inlining optimization, also adding a built-in file system watcher, a virtual modules plugin, and a Rust extension mechanism,
while dropping support for Node.js 16.</p>
<h2 id="bundler-tree-shaking-principles-and-differences"><a href="https://github.com/orgs/web-infra-dev/discussions/29" target="_blank" rel="noopener noreferrer">Bundler tree shaking principles and differences</a><a aria-hidden="true" href="#bundler-tree-shaking-principles-and-differences">#</a></h2>
<blockquote>
<p>July 31, 2025</p>
</blockquote>
<p>Tree shaking has become an essential part of modern front-end bundling. This article provides a brief overview of tree shaking principles across different bundlers and explores their key differences.</p>
<h2 id="announcing-rspack-14"><a href="/blog/announcing-1-4">Announcing Rspack 1.4</a><a aria-hidden="true" href="#announcing-rspack-14">#</a></h2>
<blockquote>
<p>June 26, 2025</p>
</blockquote>
<p>Rspack 1.4 has been released with support for running in the browser, incremental builds enabled by default, faster SWC, smaller bundles, and new features including the <code>CssChunkingPlugin</code>.</p>
<h2 id="rspack-joins-the-nextjs-ecosystem"><a href="/blog/rspack-next-partner">Rspack joins the Next.js ecosystem</a><a aria-hidden="true" href="#rspack-joins-the-nextjs-ecosystem">#</a></h2>
<blockquote>
<p>April 10, 2025</p>
</blockquote>
<p>Today, we’re excited to introduce <a href="https://www.npmjs.com/package/next-rspack" target="_blank" rel="noopener noreferrer">next-rspack</a>, a community-driven plugin bringing direct Rspack support to Next.js. This integration offers a fast, webpack-compatible alternative for teams not yet ready to adopt Turbopack.</p>
<h2 id="announcing-rspack-13"><a href="/blog/announcing-1-3">Announcing Rspack 1.3</a><a aria-hidden="true" href="#announcing-rspack-13">#</a></h2>
<blockquote>
<p>March 28, 2025</p>
</blockquote>
<p>Rspack 1.3 has been released with support for detecting circular dependencies, building HTTP imports, and referencing AMD modules. It introduces a new lazy compilation middleware, while also improving code splitting performance, output bundle size, and memory usage.</p>
<h2 id="announcing-rspack-12"><a href="/blog/announcing-1-2">Announcing Rspack 1.2</a><a aria-hidden="true" href="#announcing-rspack-12">#</a></h2>
<blockquote>
<p>January 21, 2025</p>
</blockquote>
<p>Rspack 1.2 has been released, introducing experimental persistent caching, a faster code splitting algorithm, and Yarn PnP support.</p>
<h2 id="build-systems-and-bundlers"><a href="https://github.com/orgs/web-infra-dev/discussions/24" target="_blank" rel="noopener noreferrer">Build systems and bundlers</a><a aria-hidden="true" href="#build-systems-and-bundlers">#</a></h2>
<blockquote>
<p>January 7, 2025</p>
</blockquote>
<p>This article will briefly introduce the content of the "Build Systems à la Carte: Theory and Practice" paper and attempt to summarize bundlers from the perspective of build systems.</p>
<h2 id="rsc-and-server-action-bundle-practice"><a href="https://github.com/orgs/web-infra-dev/discussions/23" target="_blank" rel="noopener noreferrer">RSC and Server Action bundle practice</a><a aria-hidden="true" href="#rsc-and-server-action-bundle-practice">#</a></h2>
<blockquote>
<p>January 6, 2025</p>
</blockquote>
<p>This article introduces the construction practices of RSC (React Server Components) and Server Action in React, including their concepts, rendering methods, bundling process in webpack, and how Turbopack bundles multiple environment modules in a module diagram.</p>
<h2 id="announcing-rspack-11"><a href="/blog/announcing-1-1">Announcing Rspack 1.1</a><a aria-hidden="true" href="#announcing-rspack-11">#</a></h2>
<blockquote>
<p>November 7, 2024</p>
</blockquote>
<p>Rspack and Rsbuild 1.1 has been released, significantly improve the performance of cold starts and incremental builds. It also improve the built-in HTML plugin and types of configuration options.</p>
<h2 id="announcing-rspack-10"><a href="/blog/announcing-1-0">Announcing Rspack 1.0</a><a aria-hidden="true" href="#announcing-rspack-10">#</a></h2>
<blockquote>
<p>August 28, 2024</p>
</blockquote>
<p>Today Rspack has reached a new milestone - 1.0. This means that Rspack is production-ready, covers most of webpack's APIs and features, and is now prepared to support more users.</p>
<h2 id="announcing-rspack-10-alpha"><a href="/blog/announcing-1-0-alpha">Announcing Rspack 1.0 Alpha</a><a aria-hidden="true" href="#announcing-rspack-10-alpha">#</a></h2>
<blockquote>
<p>June 29, 2024</p>
</blockquote>
<p>Rspack 1.0 alpha is now available on npm!</p>
<p>Before releasing Rspack 1.0 stable version, we will test for 1~2 months to improve the API stability and reliability of v1.0 and to verify its impact on downstream projects.</p>
<h2 id="announcing-rspack-07"><a href="/blog/announcing-0-7">Announcing Rspack 0.7</a><a aria-hidden="true" href="#announcing-rspack-07">#</a></h2>
<blockquote>
<p>May 28, 2024</p>
</blockquote>
<p>Rspack 0.7 has been released, featuring support for lazy compilation, which can significantly improve the dev startup performance of large applications. It also introduces a brand-new css-module-lexer, increasing CSS bundling speed by 4 times.</p>
<h2 id="deep-dive-into-rspack-tree-shaking"><a href="https://github.com/orgs/web-infra-dev/discussions/17" target="_blank" rel="noopener noreferrer">Deep dive into Rspack tree shaking</a><a aria-hidden="true" href="#deep-dive-into-rspack-tree-shaking">#</a></h2>
<blockquote>
<p>April 17, 2024</p>
</blockquote>
<p>This article primarily focuses on understanding the concept of Rspack & webpack tree shaking.</p>
<h2 id="announcing-rspack-06"><a href="/blog/announcing-0-6">Announcing Rspack 0.6</a><a aria-hidden="true" href="#announcing-rspack-06">#</a></h2>
<blockquote>
<p>April 10, 2024</p>
</blockquote>
<p>Rspack 0.6 is out, with built-in support for mini-css-extract-plugin and new tree-shaking enabled by default.</p>
<h2 id="webpack-chunk-graph-algorithm"><a href="https://github.com/orgs/web-infra-dev/discussions/15" target="_blank" rel="noopener noreferrer">Webpack chunk graph algorithm</a><a aria-hidden="true" href="#webpack-chunk-graph-algorithm">#</a></h2>
<blockquote>
<p>January 12, 2024</p>
</blockquote>
<p>This article introduces the chunk strategy of webpack. Through this article, you can understand when a chunk will be generated in the code and how to reduce the chunk size, etc.</p>
<h2 id="announcing-rspack-05"><a href="/blog/announcing-0-5">Announcing Rspack 0.5</a><a aria-hidden="true" href="#announcing-rspack-05">#</a></h2>
<blockquote>
<p>January 09, 2024</p>
</blockquote>
<p>Rspack 0.5 is out, supporting Module Federation and removing the default SWC transformation.</p>
<h2 id="module-federation-added-to-rspack"><a href="/blog/module-federation-added-to-rspack">Module Federation added to Rspack</a><a aria-hidden="true" href="#module-federation-added-to-rspack">#</a></h2>
<blockquote>
<p>January 09, 2024</p>
</blockquote>
<p>The latest Rspack 0.5.0 introduces the highly anticipated Module Federation, which is detailed in this article.</p>
<h2 id="webpack-css-order-issue"><a href="https://github.com/orgs/web-infra-dev/discussions/12" target="_blank" rel="noopener noreferrer">Webpack CSS order issue</a><a aria-hidden="true" href="#webpack-css-order-issue">#</a></h2>
<blockquote>
<p>November 29, 2023</p>
</blockquote>
<p>This article shows how the CSS order problem occurs in webpack and how to solve it.</p>
<h2 id="announcing-rspack-04"><a href="/blog/announcing-0-4">Announcing Rspack 0.4</a><a aria-hidden="true" href="#announcing-rspack-04">#</a></h2>
<blockquote>
<p>November 02, 2023</p>
</blockquote>
<p>Rspack 0.5 is out, removing support for some builtin features.</p>
<h2 id="deep-dive-into-top-level-await"><a href="https://github.com/orgs/web-infra-dev/discussions/9" target="_blank" rel="noopener noreferrer">Deep dive into Top-level await</a><a aria-hidden="true" href="#deep-dive-into-top-level-await">#</a></h2>
<blockquote>
<p>October 26, 2023</p>
</blockquote>
<p>In this article, we will take a closer look at aspects such as the specification, toolchain support, webpack runtime, and profiling of Top-level await.</p>
<h2 id="design-trade-offs-in-bundler"><a href="https://github.com/orgs/web-infra-dev/discussions/1" target="_blank" rel="noopener noreferrer">Design trade-offs in bundler</a><a aria-hidden="true" href="#design-trade-offs-in-bundler">#</a></h2>
<blockquote>
<p>August 30, 2023</p>
</blockquote>
<p>This article explains why we decided to develop Rspack and what trade-offs we made during the design process.</p>
<h2 id="announcing-rspack-03"><a href="/blog/announcing-0-3">Announcing Rspack 0.3</a><a aria-hidden="true" href="#announcing-rspack-03">#</a></h2>
<blockquote>
<p>August 24, 2023</p>
</blockquote>
<p>Rspack 0.3 is out, adding support for web workers and the builtin:swc-loader.</p>
<h2 id="announcing-rspack-02"><a href="/blog/announcing-0-2">Announcing Rspack 0.2</a><a aria-hidden="true" href="#announcing-rspack-02">#</a></h2>
<blockquote>
<p>June 02, 2023</p>
</blockquote>
<p>Rspack 0.2 is out, introducing many new features, such as support for realContentHash, DataURI, and the ESM format, and more.</p>
<h2 id="announcing-rspack-01"><a href="/blog/announcing-0-1">Announcing Rspack 0.1</a><a aria-hidden="true" href="#announcing-rspack-01">#</a></h2>
<blockquote>
<p>March 06, 2023</p>
</blockquote>
<p>Rspack has officially been released!</p>]]></content:encoded>
        </item>
    </channel>
</rss>