<?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>Fast Rust-based bundler for the web with a modernized webpack API</description>
        <lastBuildDate>Thu, 23 Apr 2026 15:04:29 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 2.0]]></title>
            <link>https://rspack.rs/blog/announcing-2-0</link>
            <guid isPermaLink="false">/blog/announcing-2-0</guid>
            <pubDate>Wed, 22 Apr 2026 16:00:01 GMT</pubDate>
            <description><![CDATA[Rspack 2.0 is out! It introduces more modern defaults, API design, and build outputs while remaining compatible with the webpack ecosystem.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>April 22, 2026</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-20"><a href="#announcing-rspack-20" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 2.0<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v2.0.png" alt="Rspack 2.0 banner"/></p>
<p>We are excited to announce the official release of Rspack 2.0!</p>
<h2 class="rp-toc-include" id="looking-back-at-1x"><a href="#looking-back-at-1x" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Looking back at 1.x</h2>
<p>When we released Rspack 1.0 in August 2024, we set a clear goal: deliver a 10x performance improvement while staying compatible with the webpack API and ecosystem.</p>
<p>Looking back at the 1.x cycle, we have largely achieved that goal. Rspack not only implemented webpack&#x27;s core capabilities and plugin APIs, but also continued to improve developer experience, output optimization, and support for modern language features. Along the way, we introduced and refined incremental builds, lazy compilation, persistent cache, constant inlining, virtual modules, barrel file optimization, and more.</p>
<p>Rspack is also being adopted by a growing number of users. Compared with the 1.0 release, <strong>Rspack&#x27;s weekly downloads have grown from 100,000 to 5 million</strong>:</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v2-0-npm-downloads.png" alt="Rspack 2.0 npm downloads"/></p>
<p>We also built Rstack around Rspack, a unified JavaScript toolchain that includes <a href="https://github.com/web-infra-dev/rsbuild" target="_blank" rel="noopener noreferrer" class="rp-link">Rsbuild</a>, <a href="https://github.com/web-infra-dev/rslib" target="_blank" rel="noopener noreferrer" class="rp-link">Rslib</a>, <a href="https://github.com/web-infra-dev/rstest" target="_blank" rel="noopener noreferrer" class="rp-link">Rstest</a>, <a href="https://github.com/web-infra-dev/rspress" target="_blank" rel="noopener noreferrer" class="rp-link">Rspress</a>, <a href="https://github.com/web-infra-dev/rsdoctor" target="_blank" rel="noopener noreferrer" class="rp-link">Rsdoctor</a>, and <a href="https://github.com/web-infra-dev/rslint" target="_blank" rel="noopener noreferrer" class="rp-link">Rslint</a>. These tools serve different use cases, but they share the same mission: making web development simpler, more consistent, and more efficient.</p>
<p>Rspack is also becoming part of the broader JavaScript ecosystem. Many excellent tools, frameworks, and platforms in the community now support Rspack, including <a href="https://nx.dev/docs/technologies/angular/angular-rspack" target="_blank" rel="noopener noreferrer" class="rp-link">Angular Rspack</a>, <a href="https://github.com/addfox/addfox" target="_blank" rel="noopener noreferrer" class="rp-link">Addfox</a>, <a href="https://github.com/facebook/docusaurus" target="_blank" rel="noopener noreferrer" class="rp-link">Docusaurus</a>, <a href="https://github.com/extension-js/extension.js" target="_blank" rel="noopener noreferrer" class="rp-link">Extension.js</a>, <a href="https://github.com/alibaba/ice" target="_blank" rel="noopener noreferrer" class="rp-link">ice.js</a>, <a href="https://github.com/lynx-family/lynx" target="_blank" rel="noopener noreferrer" class="rp-link">Lynx</a>, <a href="https://github.com/meteor/meteor" target="_blank" rel="noopener noreferrer" class="rp-link">Meteor</a>, <a href="https://github.com/web-infra-dev/modern.js" target="_blank" rel="noopener noreferrer" class="rp-link">Modern.js</a>, <a href="https://github.com/vercel/next.js" target="_blank" rel="noopener noreferrer" class="rp-link">Next.js</a>, <a href="https://github.com/nuxt/nuxt" target="_blank" rel="noopener noreferrer" class="rp-link">Nuxt</a>, <a href="https://github.com/nrwl/nx" target="_blank" rel="noopener noreferrer" class="rp-link">Nx</a>, <a href="https://github.com/kmijs/kmi" target="_blank" rel="noopener noreferrer" class="rp-link">Kmi</a>, <a href="https://github.com/callstack/repack" target="_blank" rel="noopener noreferrer" class="rp-link">Re.Pack</a>, <a href="https://github.com/remotion-dev/remotion" target="_blank" rel="noopener noreferrer" class="rp-link">Remotion</a>, <a href="https://github.com/shakacode/shakapacker" target="_blank" rel="noopener noreferrer" class="rp-link">Shakapacker</a>, <a href="https://github.com/storybookjs/storybook" target="_blank" rel="noopener noreferrer" class="rp-link">Storybook</a>, <a href="https://tanstack.com/router" target="_blank" rel="noopener noreferrer" class="rp-link">TanStack Router</a>, <a href="https://github.com/unjs/unplugin" target="_blank" rel="noopener noreferrer" class="rp-link">Unplugin</a>, <a href="https://github.com/ubugeeei/vize" target="_blank" rel="noopener noreferrer" class="rp-link">Vize</a>, <a href="https://github.com/basementstudio/xmcp" target="_blank" rel="noopener noreferrer" class="rp-link">xmcp</a>, and <a href="https://zephyr-cloud.io/" target="_blank" rel="noopener noreferrer" class="rp-link">Zephyr</a>. We sincerely thank all the projects and teams in the community that support Rspack.</p>
<h2 class="rp-toc-include" id="toward-20"><a href="#toward-20" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Toward 2.0</h2>
<p>The JavaScript ecosystem keeps evolving, and coding agents are also changing how software is built. This prompted us to rethink how a future-ready bundler should evolve.</p>
<p><strong>Rspack&#x27;s goal is not just to be a faster webpack.</strong> During the 1.x cycle, we intentionally aligned Rspack&#x27;s APIs and defaults with webpack 5 to help existing projects migrate at minimal cost. But as JavaScript modules and the surrounding ecosystem continue to evolve, some historical design choices are no longer the right defaults for modern development.</p>
<p>Starting in 2.0, while remaining compatible with the webpack ecosystem, Rspack will gradually introduce defaults, API design, and build outputs that are better aligned with modern JavaScript development. We will roll out these changes in stages. We will avoid packing too many breaking changes into a single major release whenever possible, and we will provide migration guides and Agent Skills to keep migration costs manageable.</p>
<h2 class="rp-toc-include" id="highlights-in-20"><a href="#highlights-in-20" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Highlights in 2.0</h2>
<p>Rspack 2.0 brings the following updates:</p>
<ul>
<li>Performance improvements<!-- -->
<ul>
<li><a href="#build-performance" class="rp-link">Faster builds</a></li>
<li><a href="#fewer-deps" class="rp-link">Fewer default dependencies</a></li>
</ul>
</li>
<li>Output optimization<!-- -->
<ul>
<li><a href="#better-tree-shaking" class="rp-link">Better static analysis</a></li>
<li><a href="#pure-functions" class="rp-link">Compiler annotation support</a></li>
<li><a href="#mf-share-treeshaking" class="rp-link">Module Federation tree shaking</a></li>
</ul>
</li>
<li>Improved ESM support<!-- -->
<ul>
<li><a href="#pure-esm" class="rp-link">Pure ESM packages</a></li>
<li><a href="#import-meta" class="rp-link">Support for <code>import.meta</code></a></li>
<li><a href="#import-defer" class="rp-link">Support for <code>import defer</code></a></li>
<li><a href="#modern-module" class="rp-link">Improved ESM library builds</a></li>
</ul>
</li>
<li>New features<!-- -->
<ul>
<li><a href="#rsc-support" class="rp-link">React Server Components support</a></li>
<li><a href="#subpath-alias-import" class="rp-link">Support for <code>#/</code> subpath alias imports</a></li>
<li><a href="#automatic-targets" class="rp-link">Simplified target configuration</a></li>
<li><a href="#detect-syntax" class="rp-link">Simplified <code>swc-loader</code> configuration</a></li>
<li><a href="#resolve-import" class="rp-link">Control over CSS imports</a></li>
<li><a href="#hashed-module-ids-plugin" class="rp-link">Use hashes as module IDs</a></li>
<li><a href="#enforce-size-threshold" class="rp-link">Improved code splitting</a></li>
</ul>
</li>
</ul>
<h2 class="rp-toc-include" id="performance-improvements"><a href="#performance-improvements" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Performance improvements</h2>
<h3 class="rp-toc-include" id="build-performance"><a href="#build-performance" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Faster builds</h3>
<p>Build performance has always been one of Rspack&#x27;s core priorities. Compared with Rspack 1.7, <strong>Rspack 2.0 improves overall performance by around 10%</strong>, and by as much as 100% compared with 1.0.</p>
<div class="rp-table-scroll-container rp-scrollbar"><table><thead><tr><th>Version</th><th>Production build (no cache)</th><th>Production build (with cache)</th><th>HMR</th></tr></thead><tbody><tr><td>Rspack 1.0</td><td><strong>5.6 s</strong></td><td><strong>5.6 s</strong></td><td><strong>128 ms</strong></td></tr><tr><td>Rspack 1.7</td><td><strong>3.6 s</strong></td><td><strong>2.2 s</strong></td><td><strong>134 ms</strong></td></tr><tr><td>Rspack 2.0</td><td><strong>3.1 s</strong></td><td><strong>1.4 s</strong></td><td><strong>118 ms</strong></td></tr></tbody></table></div>
<blockquote>
<p>Data source: <a href="https://github.com/LingyuCoder/rspack-react-10k-benchmark/actions/runs/24710780593" target="_blank" rel="noopener noreferrer" class="rp-link">rspack-react-10k-benchmark</a></p>
</blockquote>
<p>These improvements mainly come from continued optimization of the core architecture. We refactored parts of the algorithms and data structures on critical performance paths, upgraded outdated dependencies, and removed unused code paths.</p>
<p>With <a href="/config/cache" class="rp-link">persistent cache</a> enabled, both build performance and memory usage improve even further:</p>
<ul>
<li>Rspack now supports cache reuse for the <a href="/plugins/rspack/swc-js-minimizer-rspack-plugin" class="rp-link">SWC minimizer plugin</a>. On cache hits, <strong>build performance improves by around 50%</strong>.</li>
<li>With optimized underlying storage, <strong>memory usage drops by more than 20%</strong> when cache is enabled.</li>
</ul>
<h3 class="rp-toc-include" id="fewer-deps"><a href="#fewer-deps" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Fewer default dependencies</h3>
<p>Rspack 2.0 reduces the number of npm dependencies installed by default:</p>
<ul>
<li><code>@rspack/dev-server</code>: <strong>dependency count reduced from 192 to 1</strong>.</li>
<li><code>@rspack/core</code>: <strong>dependency count reduced from 8 to 1</strong>.</li>
<li><code>@rspack/cli</code>: <strong>now has zero dependencies</strong>.</li>
</ul>
<p>In Rspack 1.x, <code>@rspack/dev-server</code> pulled in many dependencies indirectly through <code>webpack-dev-server</code>, which increased the installation size and made dependency management more complex. To address this, we refactored it, streamlined its features and dependencies, and <strong>reduced the install size by more than 90%</strong> (from 15 MB to 1.4 MB).</p>
<p>At the same time, <code>@rspack/cli</code> no longer depends on <code>@rspack/dev-server</code> by default. That means if you only use <code>rspack build</code>, you no longer need to install dev-server-related dependencies.</p>
<p>We also reduced dependencies through the following measures:</p>
<ul>
<li>Making non-core dependencies optional. For example, <a href="https://www.npmjs.com/package/@module-federation/runtime-tools" target="_blank" rel="noopener noreferrer" class="rp-link">@module-federation/runtime-tools</a> now only needs to be installed when you use the <a href="/plugins/webpack/module-federation-plugin" class="rp-link">ModuleFederationPlugin</a>.</li>
<li>Replacing heavier dependencies with lighter alternatives, such as using <a href="https://github.com/rstackjs/connect-next" target="_blank" rel="noopener noreferrer" class="rp-link">connect-next</a> instead of Express. For dev servers, Connect&#x27;s middleware model already covers most scenarios, and using it also keeps Rspack aligned with Rsbuild&#x27;s dev server implementation.</li>
<li><a href="https://e18e.dev/blog/bundling-dependencies" target="_blank" rel="noopener noreferrer" class="rp-link">Bundling some dependencies into the npm package</a> so that Rspack can control the versions of those dependencies and their transitive dependencies, reducing potential supply-chain risks caused by automatic upgrades.</li>
<li>Preferring native Node.js 20+ APIs where possible, such as using <a href="https://nodejs.org/api/util.html#utilstyletextformat-text-options" target="_blank" rel="noopener noreferrer" class="rp-link">styleText</a> instead of <code>picocolors</code>.</li>
</ul>
<h2 class="rp-toc-include" id="output-optimization"><a href="#output-optimization" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Output optimization</h2>
<h3 class="rp-toc-include" id="better-tree-shaking"><a href="#better-tree-shaking" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Better static analysis</h3>
<p>Rspack 2.0 improves static analysis so that more complex code patterns can benefit from <a href="/guide/optimization/tree-shaking" class="rp-link">tree shaking</a>. Some patterns that were previously difficult to analyze can now participate in export-level pruning.</p>
<ul>
<li><strong>CommonJS <code>require</code> destructuring</strong>: Rspack can now identify which exported members are actually used in a destructuring assignment and keep only the required code.</li>
</ul>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-foreground)"> { </span><span style="color:var(--shiki-token-constant)">bar</span><span style="color:var(--shiki-foreground)"> } </span><span style="color:var(--shiki-token-keyword)">=</span><span style="color:var(--shiki-token-function)"> require</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./foo&#x27;</span><span style="color:var(--shiki-foreground)">);</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<ul>
<li><strong>CommonJS <code>require</code> property access and calls</strong>: Rspack can now further analyze property access and calls to determine which exports are used.</li>
</ul>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> foo</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-function)"> require</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./foo&#x27;</span><span style="color:var(--shiki-foreground)">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-constant)">foo</span><span style="color:var(--shiki-foreground)">.bar;</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">foo</span><span style="color:var(--shiki-token-function)">.baz</span><span style="color:var(--shiki-foreground)">();</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<ul>
<li><strong>Inline property access and calls on dynamic <code>import()</code> results</strong>: When module members are accessed directly in the expression, Rspack can also identify the used exports and prune the rest.</li>
</ul>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-keyword)">await</span><span style="color:var(--shiki-token-keyword)"> import</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./foo&#x27;</span><span style="color:var(--shiki-foreground)">)).bar;</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="pure-functions"><a href="#pure-functions" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Compiler annotation support</h3>
<p>Rspack 2.0 now supports <a href="https://github.com/javascript-compiler-hints/compiler-notations-spec" target="_blank" rel="noopener noreferrer" class="rp-link">compiler annotations</a>, allowing you to use <code>#__NO_SIDE_EFFECTS__</code> to mark functions as side-effect-free. When the return value of such a function call is unused, tree shaking can automatically remove the unused code.</p>
<p>For example, in the following code, <code>join</code> is marked as side-effect-free. When its return value is not used, the call can be removed safely.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">utils.js</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="utils.js"><code><span class="line"><span style="color:var(--shiki-token-comment)">/*#__NO_SIDE_EFFECTS__*/</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> function</span><span style="color:var(--shiki-token-function)"> join</span><span style="color:var(--shiki-foreground)">(a</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> b) {</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">  return</span><span style="color:var(--shiki-token-string-expression)"> `</span><span style="color:var(--shiki-token-keyword)">${</span><span style="color:var(--shiki-foreground)">a</span><span style="color:var(--shiki-token-keyword)">}</span><span style="color:var(--shiki-token-string-expression)">-</span><span style="color:var(--shiki-token-keyword)">${</span><span style="color:var(--shiki-foreground)">b</span><span style="color:var(--shiki-token-keyword)">}</span><span style="color:var(--shiki-token-string-expression)">`</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">index.js</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="index.js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { join } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./utils&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-function)">join</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;btn&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-string-expression)"> &#x27;primary&#x27;</span><span style="color:var(--shiki-foreground)">);</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>This feature is still experimental and currently requires <a href="/config/experiments#experimentspurefunctions" class="rp-link"><code>experiments.pureFunctions</code></a> to be enabled. It will be enabled by default in a future version. See the <a href="/guide/optimization/tree-shaking#no_side_effects-注解" class="rp-link">guide</a> for details.</p>
</blockquote>
<p>For third-party modules whose source code you cannot modify directly, Rspack also lets you manually declare pure functions through <a href="/config/module#moduleparserjavascriptpurefunctions" class="rp-link"><code>module.parser.javascript.pureFunctions</code></a> to achieve the same effect.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    parser</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      javascript</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        pureFunctions</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-string-expression)">&#x27;myFunctionName&#x27;</span><span style="color:var(--shiki-foreground)">]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="mf-share-treeshaking"><a href="#mf-share-treeshaking" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Module Federation tree shaking</h3>
<p>Rspack now supports tree shaking for shared dependencies in <a href="/guide/features/module-federation" class="rp-link">Module Federation</a>, allowing it to prune them at the export level, remove unused parts, and reduce the size of shared packages.</p>
<p>In Rspack 1.x, once a dependency was declared as <code>shared</code>, the runtime usually had to load the entire package. Even if only a few exports were used, the whole package would still be included. For large shared libraries, that could add significant overhead.</p>
<p>Rspack 2.0 adds <code>treeShaking</code> support to the <code>shared</code> option. When enabled, <code>ModuleFederationPlugin</code> generates a pruned build for the shared dependency and loads that result at runtime when possible. If it cannot be used, Rspack falls back to the full dependency to keep behavior consistent.</p>
<p>For example:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { rspack } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">    new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.</span><span style="color:var(--shiki-token-constant)">container</span><span style="color:var(--shiki-token-function)">.ModuleFederationPlugin</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      shared</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">        &#x27;lodash-es&#x27;</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          singleton</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          treeShaking</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            mode</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;runtime-infer&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            usedExports</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-string-expression)">&#x27;debounce&#x27;</span><span style="color:var(--shiki-foreground)">]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    })</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>See the <a href="https://module-federation.io/guide/performance/shared-tree-shaking" target="_blank" rel="noopener noreferrer" class="rp-link">shared dependency tree shaking guide</a> for more details.</p>
</blockquote>
<h2 class="rp-toc-include" id="improved-esm-support"><a href="#improved-esm-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved ESM support</h2>
<h3 class="rp-toc-include" id="pure-esm"><a href="#pure-esm" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Pure ESM packages</h3>
<p>Rspack&#x27;s core packages are now published as pure ESM packages, and their CommonJS builds have been removed. This makes module loading more consistent and better aligned with current Node.js practices.</p>
<p>This change affects the following npm packages:</p>
<ul>
<li><a href="https://www.npmjs.com/package/@rspack/core" target="_blank" rel="noopener noreferrer" class="rp-link">@rspack/core</a></li>
<li><a href="https://www.npmjs.com/package/@rspack/cli" target="_blank" rel="noopener noreferrer" class="rp-link">@rspack/cli</a></li>
<li><a href="https://www.npmjs.com/package/@rspack/dev-server" target="_blank" rel="noopener noreferrer" class="rp-link">@rspack/dev-server</a></li>
<li><a href="https://www.npmjs.com/package/@rspack/plugin-react-refresh" target="_blank" rel="noopener noreferrer" class="rp-link">@rspack/plugin-react-refresh</a></li>
</ul>
<p>In Node.js 20 and later, the runtime already supports loading ESM modules using <a href="https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require" target="_blank" rel="noopener noreferrer" class="rp-link">require(esm)</a>. For most projects that still use Rspack through the JavaScript API, this change has little practical impact and does not require additional code changes.</p>
<h3 class="rp-toc-include" id="import-meta"><a href="#import-meta" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Support for <code>import.meta</code></h3>
<p>Rspack 2.0 improves support for <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta" target="_blank" rel="noopener noreferrer" class="rp-link">import.meta</a>.</p>
<p>In Rspack 1.x, to support non-ESM output, Rspack resolved <code>import.meta</code> during compilation and replaced it with corresponding values. Unknown <code>import.meta</code> properties were usually replaced directly with <code>undefined</code>.</p>
<p>Starting in Rspack 2.0, when generating ESM output, Rspack preserves unknown <code>import.meta</code> properties by default instead of replacing them during compilation. This lets you use custom <code>import.meta</code> properties and makes the behavior closer to the ESM spec.</p>
<p>You can also control this behavior with <a href="/config/module#moduleparserjavascriptimportmeta" class="rp-link"><code>module.parser.javascript.importMeta</code></a>, for example:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  output</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    parser</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      javascript</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        importMeta</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;preserve-unknown&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>Rspack 2.0 also adds support for <a href="/api/runtime-api/module-variables#importmetamain" class="rp-link"><code>import.meta.main</code></a>, <a href="/api/runtime-api/module-variables#importmetafilename" class="rp-link"><code>import.meta.filename</code></a>, and <a href="/api/runtime-api/module-variables#importmetadirname" class="rp-link"><code>import.meta.dirname</code></a>.</p>
<h3 class="rp-toc-include" id="import-defer"><a href="#import-defer" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Support for <code>import defer</code></h3>
<p><a href="https://github.com/tc39/proposal-defer-import-eval" target="_blank" rel="noopener noreferrer" class="rp-link">import defer</a> is a JavaScript feature for deferring module evaluation, and it 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" class="rp-link">TypeScript 5.9</a>. It allows a module to be loaded without immediately evaluating it or its dependencies, giving you more control over when code runs and when side effects occur.</p>
<p>Rspack has supported the <code>import defer * as foo from &#x27;./foo&#x27;</code> syntax since 1.6. In 2.0, we expanded that support to include <code>import.defer()</code>, allowing it to cover more real-world scenarios.</p>
<ul>
<li>Enable the experimental flag:</li>
</ul>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    deferImport</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<ul>
<li>Use <code>import.defer()</code> to dynamically import a module:</li>
</ul>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">app.js</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="app.js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> file</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-constant)"> Math</span><span style="color:var(--shiki-token-function)">.random</span><span style="color:var(--shiki-foreground)">() </span><span style="color:var(--shiki-token-keyword)">&gt;</span><span style="color:var(--shiki-token-constant)"> 0.5</span><span style="color:var(--shiki-token-keyword)"> ?</span><span style="color:var(--shiki-token-string-expression)"> &#x27;a.js&#x27;</span><span style="color:var(--shiki-token-keyword)"> :</span><span style="color:var(--shiki-token-string-expression)"> &#x27;b.js&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-constant)">import</span><span style="color:var(--shiki-token-function)">.defer</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./dir&#x27;</span><span style="color:var(--shiki-token-keyword)"> +</span><span style="color:var(--shiki-foreground)"> file);</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="modern-module"><a href="#modern-module" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved ESM library builds</h3>
<p>When building JavaScript libraries, the quality of ESM output directly affects how well downstream tools can analyze and optimize it. Cleaner ESM output is usually better for static analysis, code splitting, and tree shaking.</p>
<p>In Rspack 2.0, you can set <a href="/config/output#outputlibrarytype" class="rp-link"><code>output.library.type</code></a> to <code>&#x27;modern-module&#x27;</code> to generate ESM output that is better suited to published libraries.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  output</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    library</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      type</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;modern-module&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>Compared with <a href="/config/output#outputmodule" class="rp-link"><code>output.module</code></a>, which targets general ESM output, <code>modern-module</code> is specifically optimized for library builds. It evolved from the experimental <a href="https://v1.rspack.rs/plugins/rspack/esm-library-plugin" target="_blank" rel="noopener noreferrer" class="rp-link"><code>rspack.experiments.EsmLibraryPlugin</code></a> introduced in Rspack 1.x and produces output that is easier for downstream tools to analyze and process. In code-splitting scenarios, it also preserves a cleaner ESM structure and reduces duplicated code in multi-entry builds.</p>
<p>In addition, <code>modern-module</code> supports preserving the source directory structure. See the <a href="/guide/features/esm" class="rp-link">ESM guide</a> for details.</p>
<h2 class="rp-toc-include" id="new-features"><a href="#new-features" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New features</h2>
<h3 class="rp-toc-include" id="rsc-support"><a href="#rsc-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>React Server Components support</h3>
<p><a href="https://react.dev/reference/rsc/server-components" target="_blank" rel="noopener noreferrer" class="rp-link">React Server Components</a> (RSC) are becoming an important foundation for full-stack React frameworks. Rspack 2.0 now provides experimental low-level build support, including:</p>
<ul>
<li><strong>Directive support</strong>: Handles <code>&quot;use client&quot;</code> as well as module-level and function-level <code>&quot;use server&quot;</code> directives.</li>
<li><strong>Compile-time checks</strong>: Detects React API usage that violates RSC rules during compilation, helping catch issues before they reach runtime.</li>
<li><strong>CSS support</strong>: Collects styles from server and client components during the build and injects them during rendering.</li>
<li><strong>HMR support</strong>: Supports hot updates for both server and client components.</li>
</ul>
<p>You can use this capability in two ways:</p>
<ul>
<li><strong>Use Rsbuild</strong>: We provide out-of-the-box RSC support through <a href="https://github.com/rstackjs/rsbuild-plugin-rsc" target="_blank" rel="noopener noreferrer" class="rp-link">rsbuild-plugin-rsc</a>.</li>
<li><strong>Configure Rspack manually</strong>: Refer to the <a href="/guide/tech/rsc" class="rp-link">React Server Components documentation</a> to add the required configuration yourself.</li>
</ul>
<p>Across the ecosystem, Modern.js already provides RSC support built on Rspack. See the <a href="https://modernjs.dev/guides/basic-features/render/rsc.html" target="_blank" rel="noopener noreferrer" class="rp-link">Modern.js RSC documentation</a> for details. Rspack also supports React Router&#x27;s Data Mode, with examples available in the <a href="https://github.com/rstackjs/rsbuild-plugin-rsc/tree/main/examples/react-router" target="_blank" rel="noopener noreferrer" class="rp-link">React Router examples</a>.</p>
<p>We&#x27;re also working with the <a href="https://tanstack.com/" target="_blank" rel="noopener noreferrer" class="rp-link">TanStack</a> team and plan to support <a href="https://tanstack.com/start" target="_blank" rel="noopener noreferrer" class="rp-link">TanStack Start</a> and <a href="https://tanstack.com/blog/react-server-components" target="_blank" rel="noopener noreferrer" class="rp-link">TanStack&#x27;s RSC</a> in future releases. TanStack Start is a full-stack framework built on TanStack Router, and we&#x27;re excited to explore more possibilities for RSC together.</p>
<h3 class="rp-toc-include" id="subpath-alias-import"><a href="#subpath-alias-import" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Support for <code>#/</code> subpath alias imports</h3>
<p>Rspack 2.0 supports <code>#/</code> subpath alias imports during module resolution. This lets you use the <code>imports</code> field in <code>package.json</code> directly to organize internal path mappings, without maintaining a separate alias configuration.</p>
<div class="rp-codeblock language-json"><div class="rp-codeblock__title">package.json</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="json" data-title="package.json"><code><span class="line"><span style="color:var(--shiki-foreground)">{</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">  &quot;imports&quot;</span><span style="color:var(--shiki-token-punctuation)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">    &quot;#/*&quot;</span><span style="color:var(--shiki-token-punctuation)">:</span><span style="color:var(--shiki-token-string-expression)"> &quot;./src/*&quot;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">src/index.js</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="src/index.js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> main </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;#/main.ts&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="automatic-targets"><a href="#automatic-targets" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Simplified target configuration</h3>
<p>In Rspack 1.x, the top-level <a href="/config/target" class="rp-link">target</a> option did not affect the transformation targets used by loaders or minifiers. As a result, you often had to configure target environments separately in loaders and minimizer plugins, which increased configuration overhead and duplicated the same information in multiple places.</p>
<p>Rspack 2.0 improves this behavior. Built-in loaders and minimizer plugins now read the top-level <code>target</code> configuration by default and infer their own target environments from it. In most cases, you only need to declare the target once at the top level to keep JavaScript transforms, CSS transforms, and minification aligned.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables has-diff" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  target</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;browserslist: Chrome &gt;= 100&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.js</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        use</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            loader</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;builtin:swc-loader&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            options</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line diff remove"><span style="color:var(--shiki-foreground)">              env</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> { targets</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;Chrome &gt;= 100&#x27;</span><span style="color:var(--shiki-foreground)"> }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  optimization</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    minimizer</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">      new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.SwcJsMinimizerRspackPlugin</span><span style="color:var(--shiki-foreground)">()</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">      new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.LightningCssMinimizerRspackPlugin</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line diff remove"><span style="color:var(--shiki-foreground)">        minimizerOptions</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> { targets</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;Chrome &gt;= 100&#x27;</span><span style="color:var(--shiki-foreground)"> }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      })</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>See <a href="/config/target#target-inheritance" class="rp-link">target - Target inheritance</a> for more details.</p>
</blockquote>
<h3 class="rp-toc-include" id="detect-syntax"><a href="#detect-syntax" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Simplified swc-loader configuration</h3>
<p>In earlier versions, if you wanted <a href="/guide/features/builtin-swc-loader" class="rp-link">builtin:swc-loader</a> to handle <code>.js</code>, <code>.jsx</code>, <code>.ts</code>, <code>.tsx</code>, and similar files in a single rule, you had to explicitly set options such as <code>syntax</code>, <code>jsx</code>, and <code>tsx</code> in <code>jsc.parser</code> based on the file type. This ensured that SWC could parse each file with the correct semantics, such as deciding whether <code>&lt;</code> should be treated as JSX syntax or a TypeScript generic.</p>
<p>That added extra configuration complexity. To make SWC parse files with different extensions correctly, you often needed multiple <code>rules</code>, which made the config longer and harder to maintain.</p>
<p>To solve this, Rspack 2.0 introduces the <a href="/guide/features/builtin-swc-loader#detectsyntax" class="rp-link">detectSyntax</a> option in the built-in <code>swc-loader</code>. With <code>detectSyntax: &#x27;auto&#x27;</code>, the loader automatically infers <code>parser</code> options such as <code>syntax</code>, <code>jsx</code>, and <code>tsx</code> from the file extension. A single rule can now cover multiple file types, making the configuration much cleaner.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.(?:js</span><span style="color:var(--shiki-token-keyword)">|</span><span style="color:var(--shiki-token-string-expression)">mjs</span><span style="color:var(--shiki-token-keyword)">|</span><span style="color:var(--shiki-token-string-expression)">jsx</span><span style="color:var(--shiki-token-keyword)">|</span><span style="color:var(--shiki-token-string-expression)">ts</span><span style="color:var(--shiki-token-keyword)">|</span><span style="color:var(--shiki-token-string-expression)">tsx)</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        use</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          loader</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;builtin:swc-loader&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          options</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            detectSyntax</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;auto&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="resolve-import"><a href="#resolve-import" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Control over CSS imports</h3>
<p>Rspack 2.0&#x27;s CSS parser provides the <a href="/config/module#moduleparsercssautoresolveimport" class="rp-link"><code>resolveImport</code></a> option to control whether <code>@import</code> is resolved and inlined during the build.</p>
<p>By default, Rspack resolves <code>@import</code> and merges the imported content directly into the current file. You can also set <code>resolveImport</code> to <code>false</code> to preserve the original <code>@import</code> and leave it to the browser or downstream tools.</p>
<p><code>resolveImport</code> also accepts a function, allowing you to decide whether each <code>@import</code> should be inlined. For example, you can inline only imports whose filename contains <code>style.css</code>, while leaving other imports unchanged:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    parser</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">      &#x27;css/auto&#x27;</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">        resolveImport</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> ({ url }) </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-token-constant)"> url</span><span style="color:var(--shiki-token-function)">.includes</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;style.css&#x27;</span><span style="color:var(--shiki-foreground)">)</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="hashed-module-ids-plugin"><a href="#hashed-module-ids-plugin" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Use hashes as module IDs</h3>
<p>Rspack 2.0 adds a new <code>hashed</code> option to <a href="/config/optimization#optimizationmoduleids" class="rp-link">optimization.moduleIds</a>. When enabled, Rspack generates short, stable hashes from module paths and uses them as module IDs.</p>
<p>This is useful when you want module IDs to remain stable while also shortening them. For large applications with many modules, it can also reduce their footprint in the output in some cases.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  optimization</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    moduleIds</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;hashed&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="enforce-size-threshold"><a href="#enforce-size-threshold" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved code splitting</h3>
<p>Rspack 2.0 now supports <a href="/plugins/webpack/split-chunks-plugin#splitchunksenforcesizethreshold" class="rp-link"><code>splitChunks.enforceSizeThreshold</code></a>, which lets you define a size threshold that Rspack will enforce during code splitting.</p>
<p>By default, request-count limits in <code>splitChunks</code>, such as <a href="/plugins/webpack/split-chunks-plugin#splitchunksmaxasyncrequests" class="rp-link">maxAsyncRequests</a> and <a href="/plugins/webpack/split-chunks-plugin#splitchunksmaxinitialrequests" class="rp-link">maxInitialRequests</a>, can prevent large chunks from being split further. With <code>enforceSizeThreshold</code> enabled, once a module group exceeds the configured threshold, Rspack ignores those limits and forces the split.</p>
<p>In production mode, Rspack sets a default <code>enforceSizeThreshold</code> of <code>50000</code> bytes for all module types. In other modes, the default is <code>30000</code> bytes. You can also adjust it as needed:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  optimization</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    splitChunks</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">      // Applies to all module types</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      enforceSizeThreshold</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> 50000</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">      // You can also configure it per module type</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">      // enforceSizeThreshold: { javascript: 50000, css: 30000 },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>This option can also be configured separately in cache groups, so different cache groups can use different thresholds.</p>
<h2 class="rp-toc-include" id="try-20"><a href="#try-20" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Try 2.0</h2>
<h3 class="rp-toc-include" id="create-a-new-project"><a href="#create-a-new-project" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Create a new project</h3>
<p>If you are trying Rspack for the first time, we recommend creating an <a href="https://rsbuild.rs/" target="_blank" rel="noopener noreferrer" class="rp-link">Rsbuild</a> project directly. It is an out-of-the-box build tool powered by Rspack:</p>
<div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="bash"><code><span class="line"><span style="color:var(--shiki-token-function)">npm</span><span style="color:var(--shiki-token-string)"> create</span><span style="color:var(--shiki-token-string)"> rsbuild@latest</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>See the <a href="/guide/start/quick-start" class="rp-link">Quick Start</a> for more details.</p>
</blockquote>
<h3 class="rp-toc-include" id="upgrade-from-v1"><a href="#upgrade-from-v1" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade from v1</h3>
<p>Rspack 2.0 includes some breaking changes. For existing projects, we provide an <a href="/guide/migration/rspack_1.x" class="rp-link">Upgrade Guide</a> that covers all breaking changes from v1 to v2 and how to migrate them.</p>
<p>If you use a coding agent that supports Skills, you can install the following Skill and let the agent help with the migration. In most cases, this is more efficient than upgrading manually.</p>
<div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="bash"><code><span class="line"><span style="color:var(--shiki-token-function)">npx</span><span style="color:var(--shiki-token-string)"> skills</span><span style="color:var(--shiki-token-string)"> add</span><span style="color:var(--shiki-token-string)"> rstackjs/agent-skills</span><span style="color:var(--shiki-token-string)"> --skill</span><span style="color:var(--shiki-token-string)"> rspack-v2-upgrade</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h2 class="rp-toc-include" id="looking-ahead"><a href="#looking-ahead" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Looking ahead</h2>
<p>Rspack 2.0 marks a new stage in the project&#x27;s evolution. Since 1.0, it has introduced a series of updates to its performance, API design, and build outputs. Looking forward, we will continue pushing Rspack forward in many directions, including output optimization, agent support, and toolchain collaboration.</p>
<ul>
<li><strong>Output optimization</strong>: Rspack&#x27;s goal is not only to speed up builds, but also to generate higher-quality outputs while keeping behavior stable. We will continue improving core capabilities such as tree shaking, code splitting, and static analysis, explore optimizations based on static type information, and provide finer-grained controls for code splitting and optimization.</li>
<li><strong>Agent-friendly</strong>: As coding agents become an increasingly important user group, we will incorporate these use cases more broadly into Rspack&#x27;s design so agents can understand and handle build issues more easily. For example, we will expose richer debugging information, performance metrics, and other context through the CLI, so agents can analyze problems more accurately and assist with debugging and optimization.</li>
<li><strong>Toolchain collaboration</strong>: In real-world projects, bundling is only one part of the overall workflow. Testing, type checking, and linting can also add significant overhead. We will continue evolving the Rstack toolchain as a coordinated system and deepen its integration with typescript-go. For example, Rslint already supports <a href="https://rslint.rs/guide/type-checking" target="_blank" rel="noopener noreferrer" class="rp-link"><code>rslint --type-check</code></a>, which runs linting and type checking together. We also plan to add typescript-go support to <a href="https://github.com/rstackjs/ts-checker-rspack-plugin" target="_blank" rel="noopener noreferrer" class="rp-link"><code>ts-checker-rspack-plugin</code></a>.</li>
</ul>
<blockquote>
<p>See <a href="/misc/planning/roadmap" class="rp-link">Rspack Roadmap</a> for more details.</p>
</blockquote>
<h2 class="rp-toc-include" id="faq"><a href="#faq" class="rp-header-anchor rp-link" aria-hidden="true">#</a>FAQ</h2>
<h3 class="rp-toc-include" id="will-rspack-20-still-be-compatible-with-webpack"><a href="#will-rspack-20-still-be-compatible-with-webpack" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Will Rspack 2.0 still be compatible with webpack?</h3>
<p>Yes. In the 2.0 era, compatibility with the webpack ecosystem will remain an important goal for Rspack.</p>
<p>As JavaScript standards continue to evolve, Rspack will also adopt better defaults and API design more proactively. This will happen gradually.</p>
<h3 class="rp-toc-include" id="will-the-1x-line-continue-to-be-maintained"><a href="#will-the-1x-line-continue-to-be-maintained" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Will the 1.x line continue to be maintained?</h3>
<p>Yes. After the 2.0 release, we will continue to maintain the 1.x line for a period of time, including fixes for critical issues and migration support. However, new features and optimizations will be prioritized in 2.x, so we recommend upgrading to 2.x as soon as possible.</p>
<h3 class="rp-toc-include" id="when-will-the-rspack-ecosystem-upgrade-to-20"><a href="#when-will-the-rspack-ecosystem-upgrade-to-20" class="rp-header-anchor rp-link" aria-hidden="true">#</a>When will the Rspack ecosystem upgrade to 2.0?</h3>
<p>Rsbuild 2.0 has been released alongside Rspack 2.0. See the <a href="https://rsbuild.rs/blog/v2-0" target="_blank" rel="noopener noreferrer" class="rp-link">Rsbuild 2.0 announcement</a> for more details.</p>
<p>Rslib, Rstest, and Rspress will also upgrade to Rspack 2.0 soon. At the same time, we will continue helping frameworks and tools in the community upgrade and adapt to Rspack 2.0.</p>
<h2 class="rp-toc-include" id="acknowledgements"><a href="#acknowledgements" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Acknowledgements</h2>
<p>We would like like to thank all Rspack users, contributors, and partners. Every piece of feedback and every contribution has helped move the Rspack ecosystem forward. We also hope that Rspack can continue to contribute to the broader JavaScript ecosystem.</p>
<p>We are equally grateful to the teams behind other bundlers in the community, including esbuild, Parcel, Rollup, Rolldown, Turbopack, and webpack. Their ongoing exploration in different directions has continued to inspire new ideas across the ecosystem, and has helped turn many of them into reality.</p><!--/$-->]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.7]]></title>
            <link>https://rspack.rs/blog/announcing-1-7</link>
            <guid isPermaLink="false">/blog/announcing-1-7</guid>
            <pubDate>Wed, 31 Dec 2025 16:00:00 GMT</pubDate>
            <description><![CDATA[Rspack 1.7 has been released, improving SWC Wasm plugin compatibility, importing assets as bytes, and stabilizing multiple experimental features.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>December 31, 2025</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-17"><a href="#announcing-rspack-17" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 1.7<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-7.png" alt="Rspack 1.7"/></p>
<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&#x27;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" class="rp-link">Improved SWC plugin compatibility</a></li>
<li><a href="#importing-assets-as-bytes" class="rp-link">Importing assets as bytes</a></li>
<li><a href="#lazy-compilation" class="rp-link">Lazy compilation</a></li>
<li><a href="#experimental-features-stabilized" class="rp-link">Experimental features stabilized</a></li>
</ul>
</li>
<li>Rstack progress<!-- -->
<ul>
<li><a href="#rsbuild-17" class="rp-link">Rsbuild 1.7</a></li>
<li><a href="#rsdoctor-14" class="rp-link">Rsdoctor 1.4</a></li>
<li><a href="#rslib-019" class="rp-link">Rslib 0.19</a></li>
<li><a href="#rstest-07" class="rp-link">Rstest 0.7</a></li>
<li><a href="#rspress-20-rc" class="rp-link">Rspress 2.0 RC</a></li>
</ul>
</li>
</ul>
<h2 class="rp-toc-include" id="new-features"><a href="#new-features" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New features</h2>
<h3 class="rp-toc-include" id="improved-swc-plugin-compatibility"><a href="#improved-swc-plugin-compatibility" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved SWC plugin compatibility</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" class="rp-link">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" class="rp-link">cbor</a> serialization scheme to replace the version-sensitive <a href="https://rkyv.org/" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">official guide</a> to adopt these changes and reduce maintenance costs in future version evolutions.</p>
<h3 class="rp-toc-include" id="importing-assets-as-bytes"><a href="#importing-assets-as-bytes" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Importing assets as bytes</h3>
<p>Rspack now natively supports the <a href="https://github.com/tc39/proposal-import-bytes" target="_blank" rel="noopener noreferrer" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-comment)">// Static import</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> fileBytes </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./file.bin&#x27;</span><span style="color:var(--shiki-token-keyword)"> with</span><span style="color:var(--shiki-foreground)"> { type</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;bytes&#x27;</span><span style="color:var(--shiki-foreground)"> };</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> decoder</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-keyword)"> new</span><span style="color:var(--shiki-token-function)"> TextDecoder</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;utf-8&#x27;</span><span style="color:var(--shiki-foreground)">);</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> text</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-constant)"> decoder</span><span style="color:var(--shiki-token-function)">.decode</span><span style="color:var(--shiki-foreground)">(fileBytes);</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Dynamic import</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> module</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-keyword)"> await</span><span style="color:var(--shiki-token-keyword)"> import</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./file.bin&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> { with</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> { type</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;bytes&#x27;</span><span style="color:var(--shiki-foreground)"> } });</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> decoder</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-keyword)"> new</span><span style="color:var(--shiki-token-function)"> TextDecoder</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;utf-8&#x27;</span><span style="color:var(--shiki-foreground)">);</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> text</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-constant)"> decoder</span><span style="color:var(--shiki-token-function)">.decode</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-constant)">module</span><span style="color:var(--shiki-foreground)">.default);</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="lazy-compilation"><a href="#lazy-compilation" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Lazy compilation</h3>
<p>In Rspack 1.5, we stabilized the <a href="/guide/features/lazy-compilation" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">  // Current default configuration</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  lazyCompilation</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    imports</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    entries</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> false</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">lazyCompilation</a> to <code>false</code>.</p>
<h3 class="rp-toc-include" id="experimental-features-stabilized"><a href="#experimental-features-stabilized" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Experimental features stabilized</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" class="rp-link">experiments.inlineConst</a> option is deprecated.</li>
<li>If you need to disable this behavior, use <a href="/config/optimization#optimizationinlineexports" class="rp-link">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" class="rp-link">experiments.inlineEnum</a> option is deprecated.</li>
<li>Use <a href="/guide/features/builtin-swc-loader#collecttypescriptinfoexportedenum" class="rp-link">collectTypeScriptInfo.exportedEnum</a> to control whether to collect exported <code>enum</code> information.</li>
<li>Use <a href="/config/optimization#optimizationinlineexports" class="rp-link">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" class="rp-link">experiments.typeReexportsPresence</a> option is deprecated.</li>
</ul>
</li>
</ul>
<blockquote>
<p>Refer to the <a href="#upgrade-guide" class="rp-link">Upgrade Guide</a> to learn how to adjust related configurations.</p>
</blockquote>
<h2 class="rp-toc-include" id="rstack-progress"><a href="#rstack-progress" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rstack progress</h2>
<h3 class="rp-toc-include" id="rsbuild-17"><a href="#rsbuild-17" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsbuild 1.7</h3>
<h4 class="rp-toc-include" id="error-overlay-improvements"><a href="#error-overlay-improvements" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Error overlay improvements</h4>
<p>Rsbuild&#x27;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"/></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" class="rp-link">dev.client.overlay.runtime</a> option:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rsbuild.config.ts</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rsbuild.config.ts"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  dev</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    client</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      overlay</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        runtime</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h4 class="rp-toc-include" id="asset-size-diff-reporting"><a href="#asset-size-diff-reporting" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Asset size diff reporting</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"/></p>
<p>When the <a href="https://rsbuild.rs/config/performance/print-file-size#diff" target="_blank" rel="noopener noreferrer" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rsbuild.config.ts</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rsbuild.config.ts"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  performance</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    printFileSize</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      diff</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h4 class="rp-toc-include" id="create-rsbuild-improvements"><a href="#create-rsbuild-improvements" class="rp-header-anchor rp-link" aria-hidden="true">#</a>create-rsbuild improvements</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" class="rp-link">Rstest</a> as the testing framework or enable <a href="https://storybook.rsbuild.rs/" target="_blank" rel="noopener noreferrer" class="rp-link">Storybook</a> for UI component development and debugging. Related dependencies and configurations will be set up during initialization, reducing repetitive manual configuration costs.</p>
<div class="rp-codeblock language-text"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="text"><code><span class="line"><span>◆  Select additional tools (Use &lt;space&gt; to select, &lt;enter&gt; to continue)</span></span>
<span class="line"><span>│  ◼ Rstest - testing</span></span>
<span class="line"><span>│  ◻ Biome - linting &amp; formatting</span></span>
<span class="line"><span>│  ◻ ESLint - linting</span></span>
<span class="line"><span>│  ◻ Prettier - formatting</span></span>
<span class="line"><span>│  ◻ Storybook - component development</span></span>
<span class="line"><span>└</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="rsdoctor-14"><a href="#rsdoctor-14" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsdoctor 1.4</h3>
<h4 class="rp-toc-include" id="new-treemap-view"><a href="#new-treemap-view" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New treemap view</h4>
<p>Rsdoctor 1.4 introduces an improved <a href="https://rsdoctor.rs/guide/usage/bundle-size" target="_blank" rel="noopener noreferrer" class="rp-link">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"/></p>
<h3 class="rp-toc-include" id="rslib-019"><a href="#rslib-019" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rslib 0.19</h3>
<h4 class="rp-toc-include" id="esm-output-stabilization"><a href="#esm-output-stabilization" class="rp-header-anchor rp-link" aria-hidden="true">#</a>ESM output stabilization</h4>
<p>In previous versions, Rslib enabled Rspack&#x27;s <a href="https://v1.rspack.rs/plugins/rspack/esm-library-plugin" target="_blank" rel="noopener noreferrer" class="rp-link">new ESM library output</a> through the experimental configuration <a href="https://rslib.rs/config/lib/experiments#experimentsadvancedesm" target="_blank" rel="noopener noreferrer" class="rp-link">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&#x27;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 class="rp-toc-include" id="javascript-api"><a href="#javascript-api" class="rp-header-anchor rp-link" aria-hidden="true">#</a>JavaScript API</h4>
<p>Rslib 0.19 introduces a <a href="https://rslib.rs/api/start" target="_blank" rel="noopener noreferrer" class="rp-link">JavaScript API</a>, allowing developers to invoke Rslib&#x27;s build capabilities programmatically in JavaScript code.</p>
<p>Here is a basic example:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { createRslib } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rslib/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Create Rslib instance</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> rslib</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-keyword)"> await</span><span style="color:var(--shiki-token-function)"> createRslib</span><span style="color:var(--shiki-foreground)">();</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Build production output</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">await</span><span style="color:var(--shiki-token-constant)"> rslib</span><span style="color:var(--shiki-token-function)">.build</span><span style="color:var(--shiki-foreground)">();</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>For more usage, refer to the <a href="https://rslib.rs/api/javascript-api/core" target="_blank" rel="noopener noreferrer" class="rp-link">API Documentation</a>.</p>
</blockquote>
<h3 class="rp-toc-include" id="rstest-07"><a href="#rstest-07" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rstest 0.7</h3>
<h4 class="rp-toc-include" id="configuration-adapters"><a href="#configuration-adapters" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Configuration adapters</h4>
<p>Rstest 0.7 introduces the <a href="https://rstest.rs/config/test/extends" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">@rstest/adapter-rslib</a> adapter:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rstest.config.ts</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rstest.config.ts"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { defineConfig } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rstest/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { withRslibConfig } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rstest/adapter-rslib&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-token-function)"> defineConfig</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">  // Automatically read rslib.config.ts and convert to Rstest configuration</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  extends</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-function)"> withRslibConfig</span><span style="color:var(--shiki-foreground)">()</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">  // Other test configurations</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  coverage</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">    // ...</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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&#x27;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" class="rp-link">Rstest - Adapters</a> to write custom adapters.</p>
<h4 class="rp-toc-include" id="improved-test-feedback"><a href="#improved-test-feedback" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved test feedback</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 class="rp-toc-include" id="rspress-20-rc"><a href="#rspress-20-rc" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rspress 2.0 RC</h3>
<h4 class="rp-toc-include" id="ssg-md-feature"><a href="#ssg-md-feature" class="rp-header-anchor rp-link" aria-hidden="true">#</a>SSG-MD feature</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" class="rp-link">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" class="rp-link">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" class="rp-link">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" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspress.config.ts</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspress.config.ts"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { defineConfig } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspress/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-token-function)"> defineConfig</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  llms</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>The build will generate the following structure:</p>
<div class="rp-codeblock language-txt"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="txt"><code><span class="line"><span>doc_build</span></span>
<span class="line"><span>├── llms.txt          # Summary version, containing key document index</span></span>
<span class="line"><span>├── llms-full.txt     # Full version, containing all document content</span></span>
<span class="line"><span>├── guide</span></span>
<span class="line"><span>│   └── start</span></span>
<span class="line"><span>│       └── introduction.md</span></span>
<span class="line"><span>└── ...</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>For custom components, you can control their rendering behavior in SSG-MD mode via environment variables:</p>
<div class="rp-codeblock language-tsx"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="tsx"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> function</span><span style="color:var(--shiki-token-function)"> Tab</span><span style="color:var(--shiki-foreground)">({ label }</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> { label</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> string</span><span style="color:var(--shiki-foreground)"> }) {</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">  if</span><span style="color:var(--shiki-foreground)"> (</span><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">meta</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">env</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">SSG_MD</span><span style="color:var(--shiki-foreground)">) {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">    // Output plain text description in SSG-MD mode</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">    return</span><span style="color:var(--shiki-foreground)"> &lt;&gt;{</span><span style="color:var(--shiki-token-string-expression)">`**Tab: </span><span style="color:var(--shiki-token-keyword)">${</span><span style="color:var(--shiki-foreground)">label</span><span style="color:var(--shiki-token-keyword)">}</span><span style="color:var(--shiki-token-string-expression)">**`</span><span style="color:var(--shiki-foreground)">}&lt;/&gt;;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">  // Normal interactive component rendering</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">  return</span><span style="color:var(--shiki-foreground)"> &lt;</span><span style="color:var(--shiki-token-string-expression)">div</span><span style="color:var(--shiki-token-function)"> className</span><span style="color:var(--shiki-token-keyword)">=</span><span style="color:var(--shiki-token-string-expression)">&quot;tab&quot;</span><span style="color:var(--shiki-foreground)">&gt;{label}&lt;/</span><span style="color:var(--shiki-token-string-expression)">div</span><span style="color:var(--shiki-foreground)">&gt;;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">SSG-MD Guide</a></p>
</blockquote>
<h2 class="rp-toc-include" id="upgrade-guide"><a href="#upgrade-guide" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade guide</h2>
<h3 class="rp-toc-include" id="upgrade-swc-plugins"><a href="#upgrade-swc-plugins" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade SWC plugins</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" class="rp-link">FAQ - SWC plugin version mismatch</a>.</p>
</blockquote>
<h3 class="rp-toc-include" id="remove-deprecated-configuration"><a href="#remove-deprecated-configuration" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove deprecated configuration</h3>
<ul>
<li>The following experimental options have been deprecated and can be directly removed:</li>
</ul>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables has-diff" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line diff remove"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line diff remove"><span style="color:var(--shiki-foreground)">    inlineConst</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line diff remove"><span style="color:var(--shiki-foreground)">    inlineEnum</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line diff remove"><span style="color:var(--shiki-foreground)">    typeReexportsPresence</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<ul>
<li>Adjust the position of the <a href="/guide/features/builtin-swc-loader#collecttypescriptinfo" class="rp-link">collectTypeScriptInfo</a> option in <code>builtin:swc-loader</code>, removing the <code>rspackExperiments</code> level:</li>
</ul>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables has-diff" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.ts</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        loader</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;builtin:swc-loader&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        options</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line diff remove"><span style="color:var(--shiki-foreground)">          rspackExperiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            collectTypeScriptInfo</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              exportedEnum</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              typeExports</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line diff remove"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div><!--/$-->]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.6]]></title>
            <link>https://rspack.rs/blog/announcing-1-6</link>
            <guid isPermaLink="false">/blog/announcing-1-6</guid>
            <pubDate>Thu, 30 Oct 2025 16:00:00 GMT</pubDate>
            <description><![CDATA[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.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>October 30, 2025</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-16"><a href="#announcing-rspack-16" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 1.6<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-6.png" alt="Rspack 1.6"/></p>
<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" class="rp-link">Enhanced tree shaking</a></li>
<li><a href="#support-for-import-defer" class="rp-link">Support for import defer</a></li>
<li><a href="#improved-esm-output" class="rp-link">Improved ESM output</a></li>
<li><a href="#optimized-barrels-by-default" class="rp-link">Optimized barrels by default</a></li>
<li><a href="#stabilized-layers-feature" class="rp-link">Stabilized layers feature</a></li>
<li><a href="#preserve-jsx-syntax" class="rp-link">Preserve JSX syntax</a></li>
<li><a href="#extract-source-map" class="rp-link">Extract source map</a></li>
<li><a href="#performance-improvements" class="rp-link">Performance improvements</a></li>
</ul>
</li>
<li>Rstack Progress<!-- -->
<ul>
<li><a href="#rsbuild-1-6" class="rp-link">Rsbuild 1.6</a></li>
<li><a href="#rspress-v2-beta" class="rp-link">Rspress v2 beta</a></li>
<li><a href="#rslib-0-16" class="rp-link">Rslib 0.16</a></li>
<li><a href="#rstest-0-6" class="rp-link">Rstest 0.6</a></li>
<li><a href="#rsdoctor-1-3" class="rp-link">Rsdoctor 1.3</a></li>
</ul>
</li>
<li>Ecosystem<!-- -->
<ul>
<li><a href="#next-rspack" class="rp-link">next-rspack</a></li>
</ul>
</li>
</ul>
<h2 class="rp-toc-include" id="new-features"><a href="#new-features" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New features</h2>
<h3 class="rp-toc-include" id="enhanced-tree-shaking"><a href="#enhanced-tree-shaking" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Enhanced tree shaking</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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-comment)">// Rspack 1.5 – Only supported destructured imports</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-foreground)"> { </span><span style="color:var(--shiki-token-constant)">value</span><span style="color:var(--shiki-foreground)"> } </span><span style="color:var(--shiki-token-keyword)">=</span><span style="color:var(--shiki-token-keyword)"> await</span><span style="color:var(--shiki-token-keyword)"> import</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./module&#x27;</span><span style="color:var(--shiki-foreground)">);</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(value);</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Rspack 1.6 – Now supports the following cases</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Case 1</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> mod</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-keyword)"> await</span><span style="color:var(--shiki-token-keyword)"> import</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./module&#x27;</span><span style="color:var(--shiki-foreground)">);</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-foreground)"> { </span><span style="color:var(--shiki-token-constant)">value</span><span style="color:var(--shiki-foreground)"> } </span><span style="color:var(--shiki-token-keyword)">=</span><span style="color:var(--shiki-foreground)"> mod;</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(value);</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Case 2</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> mod</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-keyword)"> await</span><span style="color:var(--shiki-token-keyword)"> import</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./module&#x27;</span><span style="color:var(--shiki-foreground)">);</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-constant)">mod</span><span style="color:var(--shiki-foreground)">.value);</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Case 3</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./module&#x27;</span><span style="color:var(--shiki-foreground)">)</span><span style="color:var(--shiki-token-function)">.then</span><span style="color:var(--shiki-foreground)">(({ value }) </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">  console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(value);</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Case 4</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./module&#x27;</span><span style="color:var(--shiki-foreground)">)</span><span style="color:var(--shiki-token-function)">.then</span><span style="color:var(--shiki-foreground)">((mod) </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">  const</span><span style="color:var(--shiki-foreground)"> { </span><span style="color:var(--shiki-token-constant)">value</span><span style="color:var(--shiki-foreground)"> } </span><span style="color:var(--shiki-token-keyword)">=</span><span style="color:var(--shiki-foreground)"> mod;</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">  console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(value);</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Case 5</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./module&#x27;</span><span style="color:var(--shiki-foreground)">)</span><span style="color:var(--shiki-token-function)">.then</span><span style="color:var(--shiki-foreground)">((mod) </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">  console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-constant)">mod</span><span style="color:var(--shiki-foreground)">.value);</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="support-for-import-defer"><a href="#support-for-import-defer" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Support for import defer</h3>
<p>Rspack now supports the <a href="https://github.com/tc39/proposal-defer-import-eval" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> defer </span><span style="color:var(--shiki-token-constant)">*</span><span style="color:var(--shiki-token-keyword)"> as</span><span style="color:var(--shiki-foreground)"> foo </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./foo&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>You can enable this feature through <a href="/config/experiments#experimentsdeferimport" class="rp-link">experiments.deferImport</a>:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    deferImport</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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 class="rp-toc-include" id="improved-esm-output"><a href="#improved-esm-output" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved ESM output</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" class="rp-link">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&#x27;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="https://v1.rspack.rs/plugins/rspack/esm-library-plugin" target="_blank" rel="noopener noreferrer" class="rp-link">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&#x27;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"/></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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { rspack } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.</span><span style="color:var(--shiki-token-constant)">experiments</span><span style="color:var(--shiki-token-function)">.EsmLibraryPlugin</span><span style="color:var(--shiki-foreground)">()]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  optimization</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">    // Recommended to enable; otherwise, consumers must import runtime code from the entry.</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    runtimeChunk</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>In addition, we&#x27;ve introduced an <code>preserveModules</code> option that preserves the original directory structure of your source files in the output:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> path </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;node:path&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">    new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.</span><span style="color:var(--shiki-token-constant)">experiments</span><span style="color:var(--shiki-token-function)">.EsmLibraryPlugin</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      preserveModules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> path</span><span style="color:var(--shiki-token-function)">.resolve</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">meta</span><span style="color:var(--shiki-foreground)">.dirname</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./src&#x27;</span><span style="color:var(--shiki-foreground)">)</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    })</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="optimized-barrels-by-default"><a href="#optimized-barrels-by-default" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Optimized barrels by default</h3>
<p>In Rspack 1.5, we introduced the experimental <a href="/config/experiments#experimentslazybarrel" class="rp-link">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 class="rp-callout rp-callout--info"><div class="rp-callout__title">Info</div><div class="rp-callout__content"><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 class="rp-toc-include" id="stabilized-layers-feature"><a href="#stabilized-layers-feature" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Stabilized layers feature</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" class="rp-link">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" class="rp-link">Layer guide</a>.</p>
<h3 class="rp-toc-include" id="preserve-jsx-syntax"><a href="#preserve-jsx-syntax" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Preserve JSX syntax</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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    parser</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      javascript</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        jsx</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-comment)"> // Enable JSX parsing</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.jsx</span><span style="color:var(--shiki-token-keyword)">?$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        use</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          loader</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;builtin:swc-loader&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          options</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            jsc</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              parser</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> { jsx</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-foreground)"> }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              transform</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">                // Preserve JSX syntax</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                react</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> { runtime</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;preserve&#x27;</span><span style="color:var(--shiki-foreground)"> }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="extract-source-map"><a href="#extract-source-map" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Extract source map</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" class="rp-link">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" class="rp-link">source-map-loader</a>, providing better performance and tighter integration with the build process.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.m</span><span style="color:var(--shiki-token-keyword)">?</span><span style="color:var(--shiki-token-string-expression)">js</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        extractSourceMap</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="performance-improvements"><a href="#performance-improvements" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Performance improvements</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" class="rp-link">Rspack benchmark</a></p>
</blockquote>
<h2 class="rp-toc-include" id="rstack-progress"><a href="#rstack-progress" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rstack progress</h2>
<p><a href="/guide/start/ecosystem#rstack" class="rp-link">Rstack</a> is a unified JavaScript toolchain centered around Rspack, featuring excellent performance and consistent architecture.</p>
<h3 class="rp-toc-include" id="rsbuild-16"><a href="#rsbuild-16" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsbuild 1.6</h3>
<h4 class="rp-toc-include" id="forward-browser-logs"><a href="#forward-browser-logs" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Forward browser logs</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"/></p>
<p>If you don&#x27;t need this feature, you can disable it by setting <a href="https://rsbuild.rs/config/dev/browser-logs" target="_blank" rel="noopener noreferrer" class="rp-link">dev.browserLogs</a> to false:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rsbuild.config.ts</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rsbuild.config.ts"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  dev</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    browserLogs</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> false</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h4 class="rp-toc-include" id="building-esm-applications"><a href="#building-esm-applications" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Building ESM applications</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" class="rp-link">output.module: true</a>:</p>
<div class="rp-codeblock language-ts"><div class="rp-codeblock__title">rsbuild.config.ts</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="ts" data-title="rsbuild.config.ts"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  output</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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 class="rp-toc-include" id="faster-configuration-loading"><a href="#faster-configuration-loading" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Faster configuration loading</h4>
<p>Since Node.js 22 already natively supports TypeScript, Rsbuild now defaults to using Node.js&#x27;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" class="rp-link">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&#x27;s --config-loader option:</p>
<div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="bash"><code><span class="line"><span style="color:var(--shiki-token-comment)"># Force use of native loading</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">rsbuild</span><span style="color:var(--shiki-token-string)"> build</span><span style="color:var(--shiki-token-string)"> --config-loader</span><span style="color:var(--shiki-token-string)"> native</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)"># Force use of jiti loading</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">rsbuild</span><span style="color:var(--shiki-token-string)"> build</span><span style="color:var(--shiki-token-string)"> --config-loader</span><span style="color:var(--shiki-token-string)"> jiti</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="rspress-v2-beta"><a href="#rspress-v2-beta" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rspress v2 beta</h3>
<h4 class="rp-toc-include" id="new-theme-preview"><a href="#new-theme-preview" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New theme preview</h4>
<p>Rspress&#x27;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" class="rp-link">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"/></p>
<h4 class="rp-toc-include" id="sub-page-switching"><a href="#sub-page-switching" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Sub-page switching</h4>
<p>Rspress v2 introduces the <a href="https://v2.rspress.rs/ui/components/page-tabs" target="_blank" rel="noopener noreferrer" class="rp-link">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"/></p>
<h3 class="rp-toc-include" id="rslib-016"><a href="#rslib-016" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rslib 0.16</h3>
<h4 class="rp-toc-include" id="faster-type-generation"><a href="#faster-type-generation" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Faster type generation</h4>
<p>Rslib now supports generating type declaration files based on <a href="https://github.com/microsoft/typescript-go" target="_blank" rel="noopener noreferrer" class="rp-link">typescript-go</a>. By simply enabling <a href="https://rslib.rs/config/lib/dts#dtstsgo" target="_blank" rel="noopener noreferrer" class="rp-link">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>
<div class="rp-codeblock language-ts"><div class="rp-codeblock__title">rslib.config.ts</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="ts" data-title="rslib.config.ts"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  lib</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      dts</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> { tsgo</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-foreground)"> }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h4 class="rp-toc-include" id="preserve-jsx-syntax-1"><a href="#preserve-jsx-syntax-1" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Preserve JSX syntax</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" class="rp-link"><code>&#x27;preserve&#x27;</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>
<div class="rp-codeblock language-ts"><div class="rp-codeblock__title">rslib.config.ts</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="ts" data-title="rslib.config.ts"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { pluginReact } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rsbuild/plugin-react&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  lib</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      bundle</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> false</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      format</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;esm&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">    pluginReact</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      swcReactOptions</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        runtime</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;preserve&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    })</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h4 class="rp-toc-include" id="more-cli-options"><a href="#more-cli-options" class="rp-header-anchor rp-link" aria-hidden="true">#</a>More CLI options</h4>
<p>Rslib supports additional <a href="https://rslib.rs/guide/basic/cli#rslib-build" target="_blank" rel="noopener noreferrer" class="rp-link">CLI options</a> in the build command, which take precedence over configuration files.</p>
<div class="rp-codeblock language-json"><div class="rp-codeblock__title">package.json</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="json" data-title="package.json"><code><span class="line"><span style="color:var(--shiki-foreground)">{</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">  &quot;scripts&quot;</span><span style="color:var(--shiki-token-punctuation)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">    &quot;build&quot;</span><span style="color:var(--shiki-token-punctuation)">:</span><span style="color:var(--shiki-token-string-expression)"> &quot;rslib build --entry index.ts --minify --tsconfig tsconfig.build.json&quot;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">lib</a> and complete the build based on command line parameters.</p>
<h3 class="rp-toc-include" id="rstest-06"><a href="#rstest-06" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rstest 0.6</h3>
<h4 class="rp-toc-include" id="vs-code-extension"><a href="#vs-code-extension" class="rp-header-anchor rp-link" aria-hidden="true">#</a>VS Code extension</h4>
<p>The <a href="https://marketplace.visualstudio.com/items?itemName=rstack.rstest" target="_blank" rel="noopener noreferrer" class="rp-link">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"/></p>
<h4 class="rp-toc-include" id="coverage-support"><a href="#coverage-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Coverage support</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" class="rp-link">Rstest – Coverage</a>.</p>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-6-rstest-cov.png" alt="rstest-coverage"/></p>
<h3 class="rp-toc-include" id="rsdoctor-13"><a href="#rsdoctor-13" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsdoctor 1.3</h3>
<h4 class="rp-toc-include" id="rsdoctor-github-actions"><a href="#rsdoctor-github-actions" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsdoctor GitHub Actions</h4>
<p>Rsdoctor now provides a <a href="https://github.com/web-infra-dev/rsdoctor-action" target="_blank" rel="noopener noreferrer" class="rp-link">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"/></p>
<h4 class="rp-toc-include" id="all-in-one-json-report"><a href="#all-in-one-json-report" class="rp-header-anchor rp-link" aria-hidden="true">#</a>All-in-one JSON report</h4>
<p>Rsdoctor now supports exporting a <a href="https://rsdoctor.rs/config/options/output#mode-brief" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">Playground page</a>, where developers can upload the JSON report to reopen and visually explore the analysis results.</p>
<h2 class="rp-toc-include" id="ecosystem"><a href="#ecosystem" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Ecosystem</h2>
<h3 class="rp-toc-include" id="next-rspack"><a href="#next-rspack" class="rp-header-anchor rp-link" aria-hidden="true">#</a>next-rspack</h3>
<p>In Next.js 16, next-rspack has integrated Rspack&#x27;s <a href="https://github.com/rstackjs/rspack-binding-template" target="_blank" rel="noopener noreferrer" class="rp-link">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>
<div class="rp-table-scroll-container rp-scrollbar"><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></div>
<p>The benchmark is based on the <a href="https://github.com/SyMind/chakra-ui-docs/tree/next-rspack" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">PERF.md</a>.</p>
<h2 class="rp-toc-include" id="upgrade-guide"><a href="#upgrade-guide" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade guide</h2>
<h3 class="rp-toc-include" id="upgrade-swc-plugins"><a href="#upgrade-swc-plugins" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade SWC plugins</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" class="rp-link">FAQ - SWC plugin version mismatch</a>.</p>
</blockquote>
<h3 class="rp-toc-include" id="remove-experimentslayer"><a href="#remove-experimentslayer" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove <code>experiments.layer</code></h3>
<p><code>experiments.layer</code> option has been deprecated, you can remove it directly:</p>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-  experiments: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-   layer: true,</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-  },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div><!--/$-->]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.5]]></title>
            <link>https://rspack.rs/blog/announcing-1-5</link>
            <guid isPermaLink="false">/blog/announcing-1-5</guid>
            <pubDate>Tue, 26 Aug 2025 11:00:00 GMT</pubDate>
            <description><![CDATA[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.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>August 26, 2025</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-15"><a href="#announcing-rspack-15" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 1.5<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-5.png" alt="Rspack 1.5"/></p>
<hr/>
<p>We&#x27;re excited to announce Rspack 1.5!</p>
<p>Notable changes include:</p>
<ul>
<li>New features<!-- -->
<ul>
<li><a href="#barrel-file-optimization" class="rp-link">Barrel file optimization</a></li>
<li><a href="#faster-file-system-watcher" class="rp-link">Faster file system watcher</a></li>
<li><a href="#improved-browser-support" class="rp-link">Improved browser support</a></li>
<li><a href="#extending-rspack-with-rust" class="rp-link">Extending Rspack with Rust</a></li>
<li><a href="#const-inline-optimization" class="rp-link">Const inline optimization</a></li>
<li><a href="#type-re-export-analysis" class="rp-link">Type re-export analysis</a></li>
<li><a href="#built-in-virtual-modules-plugin" class="rp-link">Built-in virtual modules plugin</a></li>
<li><a href="#module-federation-runtime-hoisting" class="rp-link">Module Federation runtime hoisting</a></li>
<li><a href="#installation-size-optimization" class="rp-link">Installation size optimization</a></li>
<li><a href="#seal-phase-performance-optimization" class="rp-link">Seal phase performance optimization</a></li>
</ul>
</li>
<li>Misc<!-- -->
<ul>
<li><a href="#drop-support-for-nodejs-16" class="rp-link">Drop support for Node.js 16</a></li>
<li><a href="#resolver-javascript-api" class="rp-link">Resolver JavaScript API</a></li>
</ul>
</li>
<li>Rstack progress<!-- -->
<ul>
<li><a href="#rslint-released" class="rp-link">Rslint released</a></li>
<li><a href="#rsbuild-15" class="rp-link">Rsbuild 1.5</a></li>
<li><a href="#rslib-012" class="rp-link">Rslib 0.12</a></li>
<li><a href="#rspress-20-beta" class="rp-link">Rspress 2.0 beta</a></li>
<li><a href="#rsdoctor-12" class="rp-link">Rsdoctor 1.2</a></li>
<li><a href="#rstest-02" class="rp-link">Rstest 0.2</a></li>
</ul>
</li>
</ul>
<h2 class="rp-toc-include" id="new-features"><a href="#new-features" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New features</h2>
<h3 class="rp-toc-include" id="barrel-file-optimization"><a href="#barrel-file-optimization" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Barrel file optimization</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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-foreground)"> { Button</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> Tab } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./components&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-constant)"> *</span><span style="color:var(--shiki-token-keyword)"> as</span><span style="color:var(--shiki-foreground)"> utils </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./utils&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-constant)"> *</span><span style="color:var(--shiki-token-keyword)"> from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./hooks&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    lazyBarrel</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">Benchmark</a>:</li>
</ul>
<div class="rp-table-scroll-container rp-scrollbar"><table><thead><tr><th>Metric</th><th style="text-align:right">Before</th><th style="text-align:right">After</th><th style="text-align:right">Improvement</th></tr></thead><tbody><tr><td>Build Time</td><td style="text-align:right">1.47s</td><td style="text-align:right">1.19s</td><td style="text-align:right"><code>-20%</code></td></tr><tr><td>Module Resolutions</td><td style="text-align:right">39,675</td><td style="text-align:right">20,071</td><td style="text-align:right"><code>-49%</code></td></tr><tr><td>Module Builds</td><td style="text-align:right">9,358</td><td style="text-align:right">5,062</td><td style="text-align:right"><code>-46%</code></td></tr></tbody></table></div>
<ul>
<li>An application from ByteDance:</li>
</ul>
<div class="rp-table-scroll-container rp-scrollbar"><table><thead><tr><th>Metric</th><th style="text-align:right">Before</th><th style="text-align:right">After</th><th style="text-align:right">Improvement</th></tr></thead><tbody><tr><td>Build Time</td><td style="text-align:right">17.9s</td><td style="text-align:right">16.0s</td><td style="text-align:right"><code>-10%</code></td></tr><tr><td>Module Resolutions</td><td style="text-align:right">181,078</td><td style="text-align:right">137,232</td><td style="text-align:right"><code>-24%</code></td></tr><tr><td>Module Builds</td><td style="text-align:right">38,046</td><td style="text-align:right">29,405</td><td style="text-align:right"><code>-23%</code></td></tr></tbody></table></div>
<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" class="rp-link">experiments.lazyBarrel documentation</a>.</p>
<h3 class="rp-toc-include" id="faster-file-system-watcher"><a href="#faster-file-system-watcher" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Faster file system watcher</h3>
<p>Previously, Rspack relied on the <a href="https://github.com/webpack/watchpack" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">#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" class="rp-link">experiments.nativeWatcher</a>:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    nativeWatcher</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  watchOptions</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">    // Other watch options...</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="improved-browser-support"><a href="#improved-browser-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved browser support</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" class="rp-link">StackBlitz</a>.</p>
<p>With the release of <a href="/api/javascript-api/browser" class="rp-link">@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"/></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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { rspack</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> builtinMemFs } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/browser&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Write files to memfs</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">builtinMemFs</span><span style="color:var(--shiki-token-function)">.</span><span style="color:var(--shiki-token-constant)">volume</span><span style="color:var(--shiki-token-function)">.fromJSON</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">  // ...project files</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Just like using JavaScript API of @rspack/core</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">rspack</span><span style="color:var(--shiki-foreground)">({}</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> (err</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> stats) </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">  if</span><span style="color:var(--shiki-foreground)"> (err </span><span style="color:var(--shiki-token-keyword)">||</span><span style="color:var(--shiki-token-constant)"> stats</span><span style="color:var(--shiki-token-function)">.hasErrors</span><span style="color:var(--shiki-foreground)">()) {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">    // ...</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">  // Get output from memfs after bundling</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">  const</span><span style="color:var(--shiki-token-constant)"> files</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-constant)"> builtinMemFs</span><span style="color:var(--shiki-token-function)">.</span><span style="color:var(--shiki-token-constant)">volume</span><span style="color:var(--shiki-token-function)">.toJSON</span><span style="color:var(--shiki-foreground)">();</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">Rspack Playground</a>.</p>
<h3 class="rp-toc-include" id="extending-rspack-with-rust"><a href="#extending-rspack-with-rust" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Extending Rspack with Rust</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&#x27;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&#x27;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" class="rp-link">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" class="rp-link">design rationale</a>. Note that this approach introduces additional maintenance costs and is recommended only when extreme performance optimization is required.</p>
<h3 class="rp-toc-include" id="const-inline-optimization"><a href="#const-inline-optimization" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Const inline optimization</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" class="rp-link">experiments.inlineConst</a> and <a href="/config/experiments#experimentsinlineenum" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-comment)">// font-settings.js</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> const</span><span style="color:var(--shiki-token-constant)"> bold</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-constant)"> 0b001</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> const</span><span style="color:var(--shiki-token-constant)"> italic</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-constant)"> 0b010</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// index.js</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { bold</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> italic } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./font-settings&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// MY_FONT is defined by DefinePlugin({ FONT: 0b001 })</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> fontStyle</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-foreground)"> {};</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">if</span><span style="color:var(--shiki-foreground)"> (</span><span style="color:var(--shiki-token-constant)">MY_FONT</span><span style="color:var(--shiki-token-keyword)"> &amp;</span><span style="color:var(--shiki-foreground)"> bold) fontStyle[</span><span style="color:var(--shiki-token-string-expression)">&#x27;font-weight&#x27;</span><span style="color:var(--shiki-foreground)">] </span><span style="color:var(--shiki-token-keyword)">=</span><span style="color:var(--shiki-token-string-expression)"> &#x27;bold&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">if</span><span style="color:var(--shiki-foreground)"> (</span><span style="color:var(--shiki-token-constant)">MY_FONT</span><span style="color:var(--shiki-token-keyword)"> &amp;</span><span style="color:var(--shiki-foreground)"> italic) fontStyle[</span><span style="color:var(--shiki-token-string-expression)">&#x27;font-style&#x27;</span><span style="color:var(--shiki-foreground)">] </span><span style="color:var(--shiki-token-keyword)">=</span><span style="color:var(--shiki-token-string-expression)"> &#x27;italic&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">applyFont</span><span style="color:var(--shiki-foreground)">(fontStyle);</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-foreground)">(() </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">  &#x27;use strict&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">  let</span><span style="color:var(--shiki-foreground)"> t </span><span style="color:var(--shiki-token-keyword)">=</span><span style="color:var(--shiki-foreground)"> {};</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  t[</span><span style="color:var(--shiki-token-string-expression)">&#x27;font-weight&#x27;</span><span style="color:var(--shiki-foreground)">] </span><span style="color:var(--shiki-token-keyword)">=</span><span style="color:var(--shiki-token-string-expression)"> &#x27;bold&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">  applyFont</span><span style="color:var(--shiki-foreground)">(t);</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">})();</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>For more details, see the <a href="/config/experiments#experimentsinlineconst" class="rp-link">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>
<div class="rp-codeblock language-ts"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="ts"><code><span class="line"><span style="color:var(--shiki-token-comment)">// types.ts</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> enum</span><span style="color:var(--shiki-token-function)"> Kind</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  A</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  B</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// index.ts</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { Kind } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./types.ts&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-constant)">Kind</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">A</span><span style="color:var(--shiki-foreground)">);</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>With <code>inlineEnum</code> enabled:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-foreground)">(() </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">  console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-constant)">0</span><span style="color:var(--shiki-foreground)">);</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">})();</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">example</a>.</p>
<blockquote>
<p>For more details, see the <a href="/config/experiments#experimentsinlineenum" class="rp-link">experiments.inlineEnum documentation</a>.</p>
</blockquote>
<h3 class="rp-toc-include" id="type-re-export-analysis"><a href="#type-re-export-analysis" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Type re-export analysis</h3>
<p>In TypeScript projects, type re-exports are a common pattern:</p>
<div class="rp-codeblock language-ts"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="ts"><code><span class="line"><span style="color:var(--shiki-token-comment)">// index.ts</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-foreground)"> { MyType } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./types.ts&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// types.ts</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> type</span><span style="color:var(--shiki-token-function)"> MyType</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  name</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> string</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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 &#x27;MyType&#x27; (reexported as &#x27;MyType&#x27;) 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" class="rp-link">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" class="rp-link">experiments.typeReexportsPresence documentation</a>.</p>
</blockquote>
<h3 class="rp-toc-include" id="built-in-virtual-modules-plugin"><a href="#built-in-virtual-modules-plugin" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Built-in virtual modules plugin</h3>
<p>In Rspack 1.4, we introduced <a href="/blog/announcing-1-4#custom-input-file-system" class="rp-link">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" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { rspack } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">    new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.</span><span style="color:var(--shiki-token-constant)">experiments</span><span style="color:var(--shiki-token-function)">.VirtualModulesPlugin</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">      &#x27;src/generated/config.js&#x27;</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;export default { version: &quot;1.0.0&quot; };&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    })</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>Thanks to our contributor <a href="https://github.com/nilptr" target="_blank" rel="noopener noreferrer" class="rp-link">@nilptr</a> for his great <a href="https://github.com/web-infra-dev/rspack/pull/11021" target="_blank" rel="noopener noreferrer" class="rp-link">work</a>.</p>
</blockquote>
<h3 class="rp-toc-include" id="module-federation-runtime-hoisting"><a href="#module-federation-runtime-hoisting" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Module Federation runtime hoisting</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&#x27;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>
<div class="rp-table-scroll-container rp-scrollbar"><table><thead><tr><th style="text-align:left">Configuration</th><th style="text-align:right">Before</th><th style="text-align:right">After</th><th style="text-align:right">Reduction</th></tr></thead><tbody><tr><td style="text-align:left">Multiple Entries (default)</td><td style="text-align:right">210kb</td><td style="text-align:right">210kb</td><td style="text-align:right"><code>0%</code></td></tr><tr><td style="text-align:left">Multiple Entries + runtimeChunk: true</td><td style="text-align:right">210kb</td><td style="text-align:right">150kb</td><td style="text-align:right"><code>29%</code></td></tr><tr><td style="text-align:left">Multiple Entries + runtimeChunk: &#x27;single&#x27;</td><td style="text-align:right">210kb</td><td style="text-align:right">70kb</td><td style="text-align:right"><code>67%</code></td></tr></tbody></table></div>
<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" class="rp-link">here</a>,</p>
<h3 class="rp-toc-include" id="installation-size-optimization"><a href="#installation-size-optimization" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Installation size optimization</h3>
<p>Since v1.4, we have delivered several key optimizations to reduce Rspack&#x27;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"/></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" class="rp-link">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" class="rp-link">wasmer</a>, <a href="https://github.com/swc-project/swc/pull/10638" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">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" class="rp-link">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" class="rp-link">automated size checks</a> into our daily workflow to continuously monitor changes in this metric.</p>
<h3 class="rp-toc-include" id="seal-phase-performance-optimization"><a href="#seal-phase-performance-optimization" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Seal phase performance optimization</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>
<div class="rp-table-scroll-container rp-scrollbar"><table><thead><tr><th>Phase</th><th style="text-align:right">v1.4.0</th><th style="text-align:right">v1.5.0</th><th style="text-align:right">Improvement</th></tr></thead><tbody><tr><td>Flag dependency exports</td><td style="text-align:right">394ms</td><td style="text-align:right">181ms</td><td style="text-align:right"><code>-54%</code></td></tr><tr><td>Flag dependency usage</td><td style="text-align:right">1828ms</td><td style="text-align:right">454ms</td><td style="text-align:right"><code>-75%</code></td></tr><tr><td>Code splitting</td><td style="text-align:right">2019ms</td><td style="text-align:right">777ms</td><td style="text-align:right"><code>-62%</code></td></tr><tr><td>Bundle splitting</td><td style="text-align:right">1588ms</td><td style="text-align:right">712ms</td><td style="text-align:right"><code>-55%</code></td></tr><tr><td>Module concatenation</td><td style="text-align:right">2645ms</td><td style="text-align:right">616ms</td><td style="text-align:right"><code>-76%</code></td></tr><tr><td>Content hash calculation</td><td style="text-align:right">881ms</td><td style="text-align:right">404ms</td><td style="text-align:right"><code>-54%</code></td></tr></tbody></table></div>
<h2 class="rp-toc-include" id="misc"><a href="#misc" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Misc</h2>
<h3 class="rp-toc-include" id="drop-support-for-nodejs-16"><a href="#drop-support-for-nodejs-16" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Drop support for Node.js 16</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>
<div class="rp-table-scroll-container rp-scrollbar"><table><thead><tr><th>Package</th><th style="text-align:right">v1.4</th><th style="text-align:right">v1.5</th></tr></thead><tbody><tr><td>@rspack/core</td><td style="text-align:right"><code>&gt;=16.0.0</code></td><td style="text-align:right"><code>&gt;=18.12.0</code></td></tr><tr><td>@rspack/cli</td><td style="text-align:right"><code>&gt;=18.12.0</code></td><td style="text-align:right"><code>&gt;=18.12.0</code></td></tr><tr><td>@rspack/dev-server</td><td style="text-align:right"><code>&gt;=18.12.0</code></td><td style="text-align:right"><code>&gt;=18.12.0</code></td></tr><tr><td>@rsbuild/core</td><td style="text-align:right"><code>&gt;=16.10.0</code></td><td style="text-align:right"><code>&gt;=18.12.0</code></td></tr></tbody></table></div>
<div class="rp-callout rp-callout--tip"><div class="rp-callout__title">Tip</div><div class="rp-callout__content"><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 class="rp-toc-include" id="resolver-javascript-api"><a href="#resolver-javascript-api" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Resolver JavaScript API</h3>
<p>To make it easier for our users to leverage Rspack&#x27;s module resolution capabilities, we have integrated <a href="https://github.com/rstackjs/rspack-resolver" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">enhanced-resolve</a>.</p>
<p>For usage details, please refer to the <a href="/api/javascript-api/resolver#resolver-api" class="rp-link">Resolver API documentation</a>.</p>
<h3 class="rp-toc-include" id="stabilization-of-lazy-compilation"><a href="#stabilization-of-lazy-compilation" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Stabilization of lazy compilation</h3>
<p>After extensive validation, the <a href="/config/experiments#experimentslazycompilation" class="rp-link">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>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">- experiments: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-   lazyCompilation: true,</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">- },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+ lazyCompilation: true,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>The previous experiments.lazyCompilation option will continue to work, but will emit a deprecation warning.</p>
<h3 class="rp-toc-include" id="deprecated-options"><a href="#deprecated-options" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Deprecated options</h3>
<p>The Rspack <a href="/config/experiments#experimentstoplevelawait" class="rp-link">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 class="rp-toc-include" id="rstack-progress"><a href="#rstack-progress" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rstack progress</h2>
<p><a href="/guide/start/ecosystem#rstack" class="rp-link">Rstack</a> is a unified JavaScript toolchain centered on Rspack, with high performance and consistent architecture.</p>
<h3 class="rp-toc-include" id="rslint-released"><a href="#rslint-released" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rslint released</h3>
<p><img src="https://assets.rspack.rs/rslint/rslint-banner.png" alt="rslint-banner"/></p>
<p>We are excited to announce the release of <a href="https://rslint.rs/" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">tsgolint</a>, created by <a href="https://github.com/auvred" target="_blank" rel="noopener noreferrer" class="rp-link">@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 class="rp-toc-include" id="rsbuild-15"><a href="#rsbuild-15" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsbuild 1.5</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&#x27;s latest features by default, delivering improved build performance, including:</p>
<ul>
<li>Enabled <a href="/config/lazy-compilation" class="rp-link">lazyCompilation</a> to compile dynamically imported modules on demand, improving development server startup speed.</li>
<li>Enabled <a href="/config/experiments#experimentslazybarrel" class="rp-link">lazyBarrel</a> to optimize the build performance of barrel files and reduce unnecessary module resolution.</li>
<li>Enabled <a href="/config/experiments#experimentsinlineenum" class="rp-link">inlineEnum</a> to inline TypeScript enums, reducing the bundle size after compilation.</li>
<li>Enabled <a href="/config/experiments#experimentsinlineenum" class="rp-link">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" class="rp-link">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>
<div class="rp-codeblock language-ts"><div class="rp-codeblock__title">rsbuild.config.ts</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="ts" data-title="rsbuild.config.ts"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  output</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    target</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;node&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="rslib-012"><a href="#rslib-012" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rslib 0.12</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"/></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" class="rp-link">interop tests</a> for details.</p>
<h3 class="rp-toc-include" id="rspress-20-beta"><a href="#rspress-20-beta" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rspress 2.0 beta</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"/></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" class="rp-link">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" class="rp-link">@rspress/plugin-llms documentation</a>.</p>
</blockquote>
<h3 class="rp-toc-include" id="rsdoctor-12"><a href="#rsdoctor-12" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsdoctor 1.2</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" class="rp-link">Rsdoctor 1.2 release blog</a>.</p>
<h3 class="rp-toc-include" id="rstest-02"><a href="#rstest-02" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rstest 0.2</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" class="rp-link">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"/></p><!--/$-->]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.4]]></title>
            <link>https://rspack.rs/blog/announcing-1-4</link>
            <guid isPermaLink="false">/blog/announcing-1-4</guid>
            <pubDate>Thu, 26 Jun 2025 16:00:00 GMT</pubDate>
            <description><![CDATA[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 `CssChunkingPlugin`.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>June 26, 2025</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-14"><a href="#announcing-rspack-14" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 1.4<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-4.png" alt="Rspack 1.4"/></p>
<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" class="rp-link">Running in the browser</a></li>
<li><a href="#faster-swc" class="rp-link">Faster SWC</a></li>
<li><a href="#smaller-bundles" class="rp-link">Smaller bundles</a></li>
<li><a href="#incremental-build-by-default" class="rp-link">Incremental build by default</a></li>
<li><a href="#new-csschunkingplugin" class="rp-link">New CssChunkingPlugin</a></li>
<li><a href="#enhanced-lazy-compilation" class="rp-link">Enhanced lazy compilation</a></li>
<li><a href="#custom-input-file-system" class="rp-link">Custom input file system</a></li>
<li><a href="#performance-analysis-tool" class="rp-link">Performance analysis tool</a></li>
</ul>
</li>
<li>Rstack progress<!-- -->
<ul>
<li><a href="#rsbuild-14" class="rp-link">Rsbuild 1.4</a></li>
<li><a href="#rslib-010" class="rp-link">Rslib 0.10</a></li>
<li><a href="#rspress-20-beta" class="rp-link">Rspress 2.0 beta</a></li>
<li><a href="#rsdoctor-mcp" class="rp-link">Rsdoctor MCP</a></li>
<li><a href="#rstest-released" class="rp-link">Rstest released</a></li>
</ul>
</li>
<li>Ecosystem<!-- -->
<ul>
<li><a href="#next-rspack" class="rp-link">next-rspack</a></li>
<li><a href="#kmi" class="rp-link">Kmi</a></li>
</ul>
</li>
<li>Upgrade guide</li>
</ul>
<h2 class="rp-toc-include" id="new-features"><a href="#new-features" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New features</h2>
<h3 class="rp-toc-include" id="running-in-the-browser"><a href="#running-in-the-browser" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Running in the browser</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" class="rp-link">StackBlitz</a> (<a href="https://blog.stackblitz.com/posts/introducing-webcontainers/" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">online example</a> directly, or learn about the StackBlitz usage guide in <a href="/guide/start/quick-start#preview-with-stackblitz" class="rp-link">this documentation</a>.</p>
<video src="https://assets.rspack.rs/rspack/assets/rspack-v1-4-wasm-target.mp4" autoPlay="" muted="" loop=""></video>
<p>In future versions, we will continue to optimize the Wasm version&#x27;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 class="rp-toc-include" id="faster-swc"><a href="#faster-swc" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Faster SWC</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&#x27;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>
<img src="https://assets.rspack.rs/rspack/assets/rspack-v1-4-swc-benchmark.png" alt="SWC benchmark"/>
<blockquote>
<p>The above data is from: <a href="https://codspeed.io/swc-project/swc" target="_blank" rel="noopener noreferrer" class="rp-link">CodSpeed - SWC</a>, compared against SWC 16 used by Rspack 1.3 as the baseline.</p>
</blockquote>
<h3 class="rp-toc-include" id="smaller-bundles"><a href="#smaller-bundles" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Smaller bundles</h3>
<p>SWC has enhanced its dead code elimination (DCE) capabilities in the current version, which combined with Rspack&#x27;s powerful <a href="/guide/optimization/tree-shaking" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">src/index.js</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="src/index.js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { BrowserRouter</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> Routes</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> Route } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;react-router&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-constant)">console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(BrowserRouter</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> Routes</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> Route);</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>The output bundle sizes by different bundlers are as follows:</p>
<div class="rp-table-scroll-container rp-scrollbar"><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></div>
<blockquote>
<p>Data from <a href="https://github.com/chenjiahan/react-router-tree-shaking-compare" target="_blank" rel="noopener noreferrer" class="rp-link">react-router-tree-shaking-compare</a>.</p>
</blockquote>
<h3 class="rp-toc-include" id="incremental-build-by-default"><a href="#incremental-build-by-default" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Incremental build by default</h3>
<p>After extensive optimization, Rspack&#x27;s incremental build has become stable. In Rspack 1.4, we&#x27;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>
<img src="https://assets.rspack.rs/rspack/assets/rspack-v1-4-incremental-data.png" alt="incremental benchmark" width="760"/>
<p>If you need to revert to the previous behavior, you can set <a href="/config/experiments#experimentsincremental" class="rp-link">experiments.incremental</a> to <code>&#x27;safe&#x27;</code>. However, we recommend that most projects use the new default configuration to achieve optimal performance.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">    // Revert to previous behavior</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    incremental</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;safe&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="new-csschunkingplugin"><a href="#new-csschunkingplugin" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New CssChunkingPlugin</h3>
<p>Rspack 1.4 introduces an experimental <a href="/plugins/rspack/css-chunking-plugin" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { rspack } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">    new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.</span><span style="color:var(--shiki-token-constant)">experiments</span><span style="color:var(--shiki-token-function)">.CssChunkingPlugin</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">      // ...options</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    })</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">documentation</a> for more details.</p>
<blockquote>
<p>This plugin is inspired by Next.js&#x27;s <a href="https://nextjs.org/docs/app/api-reference/config/next-config-js/cssChunking" target="_blank" rel="noopener noreferrer" class="rp-link">CSS Chunking</a> feature. Thanks to the Next.js team for their innovation in this area.</p>
</blockquote>
<h3 class="rp-toc-include" id="enhanced-lazy-compilation"><a href="#enhanced-lazy-compilation" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Enhanced lazy compilation</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" class="rp-link">lazyCompilation options</a> for each compiler instance.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    target</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;web&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">      // enable lazy compilation for client</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      lazyCompilation</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    target</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;node&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">      // disable lazy compilation for server</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      lazyCompilation</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> false</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">];</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="custom-input-file-system"><a href="#custom-input-file-system" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Custom input file system</h3>
<p>Rspack now allows you to customize <code>compiler.inputFileSystem</code> (the compiler&#x27;s input file system). This feature can be enabled by configuring <a href="/config/experiments#experimentsuseinputfilesystem" class="rp-link">experiments.useInputFileSystem</a>. Typical use cases include:</p>
<ul>
<li>Using <a href="https://github.com/streamich/memfs" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">webpack-virtual-modules plugin</a> to support virtual modules.</li>
</ul>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> VirtualModulesPlugin </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;webpack-virtual-modules&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  entry</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./virtualEntry.js&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">    new</span><span style="color:var(--shiki-token-function)"> VirtualModulesPlugin</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">      &#x27;virtualEntry.js&#x27;</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> `console.log(&#x27;virtual entry&#x27;)`</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    })</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    useInputFileSystem</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-string-expression)">/virtualEntry\.js</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-foreground)">]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">documentation</a>.</p>
</blockquote>
<h3 class="rp-toc-include" id="performance-analysis-tool"><a href="#performance-analysis-tool" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Performance analysis tool</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" class="rp-link">perfetto</a> to quickly identify build performance bottlenecks.</p>
<p>You can enable tracing through the <code>RSPACK_PROFILE</code> environment variable:</p>
<div class="rp-codeblock language-sh"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="sh"><code><span class="line"><span style="color:var(--shiki-foreground)">RSPACK_PROFILE</span><span style="color:var(--shiki-token-keyword)">=</span><span style="color:var(--shiki-token-string)">OVERVIEW</span><span style="color:var(--shiki-token-function)"> rspack</span><span style="color:var(--shiki-token-string)"> build</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">ui.perfetto.dev</a>:</p>
<img src="https://assets.rspack.rs/rspack/assets/rspack-v1-4-tracing.png" alt="tracing"/>
<blockquote>
<p>For more detailed usage, see the <a href="/contribute/development/tracing" class="rp-link">Tracing documentation</a>.</p>
</blockquote>
<h3 class="rp-toc-include" id="dependency-upgrades"><a href="#dependency-upgrades" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Dependency upgrades</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" class="rp-link">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" class="rp-link">Biome v2</a> as an optional linter and formatter.</li>
</ul>
<h2 class="rp-toc-include" id="rstack-progress"><a href="#rstack-progress" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rstack progress</h2>
<p><a href="/guide/start/ecosystem#rstack" class="rp-link">Rstack</a> is a unified JavaScript toolchain centered on Rspack, with high performance and consistent architecture.</p>
<h3 class="rp-toc-include" id="rsbuild-14"><a href="#rsbuild-14" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsbuild 1.4</h3>
<p>Rsbuild 1.4 has been released alongside Rspack 1.4, with notable features including:</p>
<h4 class="rp-toc-include" id="chrome-devtools-integration"><a href="#chrome-devtools-integration" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Chrome DevTools integration</h4>
<p>We&#x27;ve introduced a new <a href="https://github.com/rstackjs/rsbuild-plugin-devtools-json" target="_blank" rel="noopener noreferrer" class="rp-link">rsbuild-plugin-devtools-json</a> plugin, which enables seamless integration with Chrome DevTools&#x27; new <a href="https://chromium.googlesource.com/devtools/devtools-frontend/+/main/docs/ecosystem/automatic_workspace_folders.md" target="_blank" rel="noopener noreferrer" class="rp-link">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>
<img src="https://assets.rspack.rs/rspack/assets/rspack-v1-4-rsbuild-plugin-dev-tools-json.png" alt="rsbuild plugin devtools json" width="760"/>
<h4 class="rp-toc-include" id="improved-query-parameters"><a href="#improved-query-parameters" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved query parameters</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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> rawJs </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./script1.js?raw&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> rawTs </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./script2.ts?raw&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> rawJsx </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./script3.jsx?raw&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-constant)">console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(rawJs); </span><span style="color:var(--shiki-token-comment)">// Raw content of JS file</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(rawTs); </span><span style="color:var(--shiki-token-comment)">// Raw content of TS file</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(rawJsx); </span><span style="color:var(--shiki-token-comment)">// Raw content of JSX file</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h4 class="rp-toc-include" id="improved-browser-compatibility"><a href="#improved-browser-compatibility" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved browser compatibility</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&#x27;s build target is ES2016 and utils&#x27; 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>
<img src="https://assets.rspack.rs/rspack/assets/rspack-v1-4-rsbuild-monorepo-compile-scope.png" alt="rsbuild monorepo compile scope" width="600"/>
<h3 class="rp-toc-include" id="rslib-010"><a href="#rslib-010" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rslib 0.10</h3>
<p>Rslib 0.10 has been released, with notable features including:</p>
<h4 class="rp-toc-include" id="esm-output-optimization"><a href="#esm-output-optimization" class="rp-header-anchor rp-link" aria-hidden="true">#</a>ESM output optimization</h4>
<p>Rslib now generates cleaner, more concise, and smaller ESM output by default.</p>
<img src="https://assets.rspack.rs/rspack/assets/rspack-v1-4-rslib-esm.png" alt="rslib esm" width="700"/>
<h4 class="rp-toc-include" id="building-vue-ui-libraries"><a href="#building-vue-ui-libraries" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Building Vue UI libraries</h4>
<p>By integrating the <a href="https://github.com/rstackjs/rsbuild-plugin-unplugin-vue" target="_blank" rel="noopener noreferrer" class="rp-link">rsbuild-plugin-unplugin-vue</a> plugin, you can use Rslib to generate bundleless builds for Vue UI libraries.</p>
<div class="rp-codeblock language-ts"><div class="rp-codeblock__title">rslib.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="ts" data-title="rslib.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { defineConfig } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rslib/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { pluginUnpluginVue } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;rsbuild-plugin-unplugin-vue&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-token-function)"> defineConfig</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-function)">pluginUnpluginVue</span><span style="color:var(--shiki-foreground)">()]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  lib</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      format</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;esm&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      bundle</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> false</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      output</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        target</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;web&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h4 class="rp-toc-include" id="output-iife-format"><a href="#output-iife-format" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Output IIFE format</h4>
<p>Rslib now supports generating <a href="https://rslib.rs/guide/basic/output-format#iife" target="_blank" rel="noopener noreferrer" class="rp-link">IIFE</a> format output, wrapping the code in a function expression.</p>
<img src="https://assets.rspack.rs/rspack/assets/rspack-v1-4-rslib-iife.png" alt="rslib iife" width="700"/>
<blockquote>
<p>See the <a href="https://rslib.rs/blog/introducing-rslib" target="_blank" rel="noopener noreferrer" class="rp-link">blog</a> for more information about Rslib.</p>
</blockquote>
<h3 class="rp-toc-include" id="rspress-20-beta"><a href="#rspress-20-beta" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rspress 2.0 beta</h3>
<p>We are actively developing <a href="https://github.com/web-infra-dev/rspress" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">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>
<img src="https://assets.rspack.rs/rspack/assets/rspack-v1-4-rspress-preview.png" alt="rspress theme preview" width="800"/>
<h3 class="rp-toc-include" id="rsdoctor-mcp"><a href="#rsdoctor-mcp" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsdoctor MCP</h3>
<p>Rsdoctor has introduced <a href="https://rsdoctor.rs/guide/start/mcp" target="_blank" rel="noopener noreferrer" class="rp-link">@rsdoctor/mcp-server</a>, which combines LLMs to help you better analyze build data. It can access Rsdoctor&#x27;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>
<video src="https://assets.rspack.rs/rspack/assets/rspack-v1-4-rsdoctor-mcp.mp4" autoPlay="" muted="" loop=""></video>
<h3 class="rp-toc-include" id="rstest-released"><a href="#rstest-released" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rstest released</h3>
<p><a href="https://github.com/web-infra-dev/rstest" target="_blank" rel="noopener noreferrer" class="rp-link">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>
<img src="https://assets.rspack.rs/rspack/assets/rspack-v1-4-rstest.png" alt="rstest" width="600"/>
<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 class="rp-toc-include" id="ecosystem"><a href="#ecosystem" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Ecosystem</h2>
<h3 class="rp-toc-include" id="next-rspack"><a href="#next-rspack" class="rp-header-anchor rp-link" aria-hidden="true">#</a>next-rspack</h3>
<p>Since <a href="/blog/rspack-next-partner" class="rp-link">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>
<img src="https://assets.rspack.rs/rspack/assets/rspack-v1-4-next-rspack.png" alt="next-rspack" width="760"/>
<h3 class="rp-toc-include" id="kmi"><a href="#kmi" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Kmi</h3>
<p><a href="https://github.com/kmijs/kmi" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">Kmi repository</a>.</p>
<h2 class="rp-toc-include" id="upgrade-guide"><a href="#upgrade-guide" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade guide</h2>
<h3 class="rp-toc-include" id="upgrade-swc-plugins"><a href="#upgrade-swc-plugins" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade SWC plugins</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" class="rp-link">FAQ - SWC plugin version mismatch</a>.</p>
</blockquote>
<h3 class="rp-toc-include" id="lazy-compilation-middleware"><a href="#lazy-compilation-middleware" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Lazy compilation middleware</h3>
<p>The lazy compilation middleware has changed its way of accessing the <a href="/config/experiments#experimentslazycompilation" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { experiments</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> rspack } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { RspackDevServer } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/dev-server&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> compiler</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-function)"> rspack</span><span style="color:var(--shiki-foreground)">([</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">  // ...multiple configs</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">]);</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// no longer need to pass options to the middleware</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> middleware</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-constant)"> experiments</span><span style="color:var(--shiki-token-function)">.lazyCompilationMiddleware</span><span style="color:var(--shiki-foreground)">(compiler);</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> server</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-keyword)"> new</span><span style="color:var(--shiki-token-function)"> RspackDevServer</span><span style="color:var(--shiki-foreground)">(</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  {</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">    setupMiddlewares</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> (other) </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> [middleware</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-keyword)"> ...</span><span style="color:var(--shiki-foreground)">other]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  compiler</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">);</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div><!--/$-->]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rspack joins the Next.js ecosystem]]></title>
            <link>https://rspack.rs/blog/rspack-next-partner</link>
            <guid isPermaLink="false">/blog/rspack-next-partner</guid>
            <pubDate>Thu, 10 Apr 2025 10:00:00 GMT</pubDate>
            <description><![CDATA[Today, we’re excited to introduce next-rspack, 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.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>April 10, 2025</em></p>
<h1 class="rp-toc-include" id="rspack-joins-the-nextjs-ecosystem"><a href="#rspack-joins-the-nextjs-ecosystem" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rspack joins the Next.js ecosystem<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<p>One of Rspack&#x27;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" class="rp-link">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&#x27;s applicability in complex projects and provides Next.js users with an alternative solution to improve developer experience.</p>
<h2 class="rp-toc-include" id="rspack-comes-to-nextjs"><a href="#rspack-comes-to-nextjs" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rspack comes to Next.js</h2>
<p>Today, we’re excited to introduce <a href="https://www.npmjs.com/package/next-rspack" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">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" class="rp-link">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" class="rp-link">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 class="rp-toc-include" id="partnering-with-vercel-on-shared-foundations"><a href="#partnering-with-vercel-on-shared-foundations" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Partnering with Vercel on shared foundations</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" class="rp-link">SWC</a> and <a href="https://lightningcss.dev/" target="_blank" rel="noopener noreferrer" class="rp-link">Lightning CSS</a>—widely adopted tools across the JavaScript ecosystem.</p>
<p>By working together to enhance these core components, we&#x27;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" class="rp-link">arewerspackyet</a> and following <a href="https://x.com/rspack_dev" target="_blank" rel="noopener noreferrer" class="rp-link">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 class="rp-toc-include" id="performance-insights"><a href="#performance-insights" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Performance insights</h2>
<h3 class="rp-toc-include" id="app-router-users"><a href="#app-router-users" class="rp-header-anchor rp-link" aria-hidden="true">#</a>App router users</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 class="rp-toc-include" id="page-router-users"><a href="#page-router-users" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Page router users</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&#x27;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" class="rp-link">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 class="rp-toc-include" id="frequently-asked-questions"><a href="#frequently-asked-questions" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Frequently asked questions</h2>
<h3 class="rp-toc-include" id="how-will-it-remain-supported"><a href="#how-will-it-remain-supported" class="rp-header-anchor rp-link" aria-hidden="true">#</a>How will it remain supported?</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 class="rp-toc-include" id="who-maintains-it"><a href="#who-maintains-it" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Who maintains it?</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 class="rp-toc-include" id="does-this-have-any-impact-on-turbopack-is-vercel-adopting-rspack"><a href="#does-this-have-any-impact-on-turbopack-is-vercel-adopting-rspack" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Does this have any impact on Turbopack? is Vercel adopting Rspack?</h3>
<p>Rspack doesn&#x27;t replace Turbopack. It&#x27;s an alternative solution for those with extensive webpack configurations who are not ready to migrate to Turbopack.</p>
<h3 class="rp-toc-include" id="what-are-known-issues"><a href="#what-are-known-issues" class="rp-header-anchor rp-link" aria-hidden="true">#</a>What are known issues?</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" class="rp-link">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" class="rp-link">feedback discussion</a>, even when you don&#x27;t run into problems.</li>
<li>Due to the current plugin implementation, the performance of the App Router is still suboptimal and there&#x27;s still plenty of room for performance improvement.</li>
<li>Since Rspack is not 100% compatible with webpack&#x27;s API, some of your webpack plugins may not work smoothly on Rspack. Let us know if you have compatibility problems.</li>
</ul>
<h3 class="rp-toc-include" id="how-can-you-help"><a href="#how-can-you-help" class="rp-header-anchor rp-link" aria-hidden="true">#</a>How can you help?</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 class="rp-toc-include" id="future-plans"><a href="#future-plans" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Future plans</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&#x27;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 isPermaLink="false">/blog/announcing-1-3</guid>
            <pubDate>Fri, 28 Mar 2025 16:00:00 GMT</pubDate>
            <description><![CDATA[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.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>March 28, 2025</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-13"><a href="#announcing-rspack-13" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 1.3<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-3.png" alt="Rspack 1.3"/></p>
<hr/>
<p>Rspack 1.3 has been released!</p>
<p>Notable changes:</p>
<ul>
<li>New features<!-- -->
<ul>
<li><a href="#circular-dependency-detection" class="rp-link">Circular dependency detection</a></li>
<li><a href="#build-http-imports" class="rp-link">Build HTTP imports</a></li>
<li><a href="#lazy-compilation-improvements" class="rp-link">Lazy compilation improvements</a></li>
<li><a href="#amd-supports" class="rp-link">AMD supports</a></li>
</ul>
</li>
<li>Performance improvements<!-- -->
<ul>
<li><a href="#code-splitting-25-faster" class="rp-link">Code splitting 25% faster</a></li>
<li><a href="#bundle-size-optimization" class="rp-link">Bundle size optimization</a></li>
<li><a href="#memory-improvements" class="rp-link">Memory improvements</a></li>
</ul>
</li>
<li>Rstack updates<!-- -->
<ul>
<li><a href="#rsdoctor-10" class="rp-link">Rsdoctor 1.0</a></li>
<li><a href="#rsbuild-13" class="rp-link">Rsbuild 1.3</a></li>
<li><a href="#rslib-06" class="rp-link">Rslib 0.6</a></li>
<li><a href="#rspress-and-rstest" class="rp-link">Rspress and Rstest</a></li>
</ul>
</li>
<li>Ecosystem<!-- -->
<ul>
<li><a href="#rspeedy-for-lynx" class="rp-link">Rspeedy for Lynx</a></li>
<li><a href="#repack-5" class="rp-link">Re.Pack 5</a></li>
<li><a href="#react-router-v7-support" class="rp-link">React Router v7 support</a></li>
</ul>
</li>
<li>Upgrade guide<!-- -->
<ul>
<li><a href="#module-subtypes-changed" class="rp-link">Module subtypes changed</a></li>
<li><a href="#upgrade-swc-plugins" class="rp-link">Upgrade SWC plugins</a></li>
</ul>
</li>
</ul>
<h2 class="rp-toc-include" id="new-features"><a href="#new-features" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New features</h2>
<h3 class="rp-toc-include" id="circular-dependency-detection"><a href="#circular-dependency-detection" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Circular dependency detection</h3>
<p>Rspack 1.3 introduces a built-in plugin <a href="/plugins/rspack/circular-dependency-rspack-plugin" class="rp-link">CircularDependencyRspackPlugin</a> to detect circular dependencies between runtime modules.</p>
<p>This plugin is implemented in Rust and deeply integrated with Rspack&#x27;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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { rspack } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.CircularDependencyRspackPlugin</span><span style="color:var(--shiki-foreground)">()]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>Special thanks to <a href="https://github.com/faultyserver" target="_blank" rel="noopener noreferrer" class="rp-link">@faultyserver</a> for contributing this plugin ❤️</p>
</blockquote>
<h3 class="rp-toc-include" id="build-http-imports"><a href="#build-http-imports" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Build HTTP imports</h3>
<p>In previous versions, you could import HTTP/HTTPS resources by using <a href="/config/externals#externalspresetsweb" class="rp-link">externalsPresets.web</a> or <a href="/config/externals#externalspresetswebasync" class="rp-link">externalsPresets.webAsync</a> options, which simply externals the these resources and let the browser (or other platform) to fetch them at runtime.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> pMap </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;https://esm.sh/p-map&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>And the new <a href="/config/experiments#experimentsbuildhttp" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    buildHttp</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      allowedUris</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-string-expression)">&#x27;https://esm.sh/&#x27;</span><span style="color:var(--shiki-foreground)">]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>See <a href="/config/experiments#experimentsbuildhttp" class="rp-link">the docs</a> for more details.</p>
</blockquote>
<h3 class="rp-toc-include" id="lazy-compilation-improvements"><a href="#lazy-compilation-improvements" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Lazy compilation improvements</h3>
<p>In previous versions, when <a href="/guide/features/lazy-compilation" class="rp-link">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&#x27;s an example of how to use the lazy compilation middleware:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { rspack } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> config </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./rspack.config.mjs&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> DevServer </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;webpack-dev-server&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> compiler</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-function)"> rspack</span><span style="color:var(--shiki-foreground)">(config);</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> middleware</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.</span><span style="color:var(--shiki-token-constant)">experiments</span><span style="color:var(--shiki-token-function)">.lazyCompilationMiddleware</span><span style="color:var(--shiki-foreground)">(</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  compiler</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">  config</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">experiments</span><span style="color:var(--shiki-foreground)">.lazyCompilation</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">);</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> server</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-keyword)"> new</span><span style="color:var(--shiki-token-function)"> DevServer</span><span style="color:var(--shiki-foreground)">(</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  {</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">    setupMiddlewares</span><span style="color:var(--shiki-foreground)">(other) {</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">      return</span><span style="color:var(--shiki-foreground)"> [middleware</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-keyword)"> ...</span><span style="color:var(--shiki-foreground)">other];</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  compiler</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">);</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="amd-supports"><a href="#amd-supports" class="rp-header-anchor rp-link" aria-hidden="true">#</a>AMD supports</h3>
<p>Rspack now allows you to enable AMD module support by using the <a href="/config/other-options#amd" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  amd</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">    // ...</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>Special thanks to <a href="https://github.com/nilptr" target="_blank" rel="noopener noreferrer" class="rp-link">@nilptr</a> for contributing this plugin ❤️</p>
</blockquote>
<h2 class="rp-toc-include" id="performance-improvements"><a href="#performance-improvements" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Performance improvements</h2>
<h3 class="rp-toc-include" id="code-splitting-25-faster"><a href="#code-splitting-25-faster" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Code splitting 25% faster</h3>
<p>In Rspack 1.2, we introduced the <a href="/config/experiments#experimentsparallelcodesplitting" class="rp-link">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 class="rp-toc-include" id="bundle-size-optimization"><a href="#bundle-size-optimization" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Bundle size optimization</h3>
<p>Rspack 1.3 introduces full support for the <a href="/config/output#outputenvironment" class="rp-link">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" class="rp-link">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>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff"><code><span class="line"><span style="color:var(--shiki-foreground)">// before</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">- __webpack_require__.d = function(exports, definition) {</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-foreground)">// after</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+ __webpack_require__.d = (exports, definition) =&gt; {</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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 class="rp-toc-include" id="memory-improvements"><a href="#memory-improvements" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Memory improvements</h3>
<p>Rspack now defaults to using <a href="https://github.com/microsoft/mimalloc" target="_blank" rel="noopener noreferrer" class="rp-link">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&#x27;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&#x27;s not being used in the next compilation.</p>
<img src="https://assets.rspack.rs/rspack/assets/rspack-v1-3-memory-improve-max-generations.png" width="760" alt="Max generations"/>
<h2 class="rp-toc-include" id="rstack-updates"><a href="#rstack-updates" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rstack updates</h2>
<img src="https://assets.rspack.rs/rstack/rstack-overview.png" width="760" alt="Rstack"/>
<h3 class="rp-toc-include" id="rsdoctor-10"><a href="#rsdoctor-10" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsdoctor 1.0</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" class="rp-link">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" class="rp-link">Rsdoctor 1.0 release blog</a> for more.</p>
</blockquote>
<h3 class="rp-toc-include" id="rsbuild-13"><a href="#rsbuild-13" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsbuild 1.3</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" class="rp-link">?inline</a> query parameter:</li>
</ul>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> inlineCss </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./style.css?inline&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-constant)">console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(inlineCss); </span><span style="color:var(--shiki-token-comment)">// Output the compiled CSS file content</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">?raw</a> query parameter:</li>
</ul>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> rawSvg </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./logo.svg?raw&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> rawCss </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./style.css?raw&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-constant)">console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(rawSvg); </span><span style="color:var(--shiki-token-comment)">// Output the raw SVG file content</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(rawCss); </span><span style="color:var(--shiki-token-comment)">// Output the raw CSS file content</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="rslib-06"><a href="#rslib-06" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rslib 0.6</h3>
<p>Rslib 0.6 brings the following notable updates:</p>
<ul>
<li><strong>Improved CJS output</strong>: Rslib&#x27;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" class="rp-link">Rslib 0.6</a> for more details.</p>
<h3 class="rp-toc-include" id="rspress-and-rstest"><a href="#rspress-and-rstest" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rspress and Rstest</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 class="rp-toc-include" id="ecosystem"><a href="#ecosystem" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Ecosystem</h2>
<h3 class="rp-toc-include" id="rspeedy-for-lynx"><a href="#rspeedy-for-lynx" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rspeedy for Lynx</h3>
<p><a href="https://lynxjs.org/" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">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=""/></p>
<blockquote>
<p>Read the <a href="https://lynxjs.org/blog/lynx-unlock-native-for-more.html" target="_blank" rel="noopener noreferrer" class="rp-link">Introductory Blog of Lynx</a> for more.</p>
</blockquote>
<h3 class="rp-toc-include" id="repack-5"><a href="#repack-5" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Re.Pack 5</h3>
<p><a href="https://github.com/callstack/repack" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">Re.Pack 5 release blog</a> for more.</p>
</blockquote>
<h3 class="rp-toc-include" id="react-router-v7-support"><a href="#react-router-v7-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>React Router v7 support</h3>
<p><a href="https://github.com/rstackjs/rsbuild-plugin-react-router" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">rsbuild-plugin-react-router repository</a> to try it out.</p>
</blockquote>
<h2 class="rp-toc-include" id="upgrade-guide"><a href="#upgrade-guide" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade guide</h2>
<h3 class="rp-toc-include" id="module-types-changed"><a href="#module-types-changed" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Module types changed</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&#x27;s specific type in two ways:</p>
<div class="rp-codeblock language-ts"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="ts"><code><span class="line"><span style="color:var(--shiki-token-comment)">// Method 1: Instance type checking</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">module</span><span style="color:var(--shiki-token-function)"> instanceof</span><span style="color:var(--shiki-token-function)"> NormalModule</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Method 2: Constructor signature detection</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">module</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">constructor</span><span style="color:var(--shiki-foreground)">.name </span><span style="color:var(--shiki-token-keyword)">===</span><span style="color:var(--shiki-token-string-expression)"> &#x27;NormalModule&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>The new type definitions may cause type errors in existing JavaScript API code, such as:</p>
<div class="rp-codeblock language-ts"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="ts"><code><span class="line"><span style="color:var(--shiki-token-constant)">module</span><span style="color:var(--shiki-foreground)">.resource; </span><span style="color:var(--shiki-token-comment)">// TypeScript Error: Property &#x27;resource&#x27; does not exist on type &#x27;Module&#x27;</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>To access the <code>resource</code> property, you now need to assert the module type using one of the following methods:</p>
<div class="rp-codeblock language-ts"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="ts"><code><span class="line"><span style="color:var(--shiki-token-comment)">// Solution 1: `in` operator type guard</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">if</span><span style="color:var(--shiki-foreground)"> (</span><span style="color:var(--shiki-token-string-expression)">&#x27;resource&#x27;</span><span style="color:var(--shiki-token-keyword)"> in</span><span style="color:var(--shiki-token-constant)"> module</span><span style="color:var(--shiki-foreground)">) {</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">  console</span><span style="color:var(--shiki-token-function)">.log</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-constant)">module</span><span style="color:var(--shiki-foreground)">.resource);</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Solution 2: Instance type assertion</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">if</span><span style="color:var(--shiki-foreground)"> (</span><span style="color:var(--shiki-token-constant)">module</span><span style="color:var(--shiki-token-keyword)"> instanceof</span><span style="color:var(--shiki-token-function)"> NormalModule</span><span style="color:var(--shiki-foreground)">) {</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">  module</span><span style="color:var(--shiki-foreground)">.resource;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="upgrade-swc-plugins"><a href="#upgrade-swc-plugins" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade SWC plugins</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" class="rp-link">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 isPermaLink="false">/blog/announcing-1-2</guid>
            <pubDate>Tue, 21 Jan 2025 16:00:00 GMT</pubDate>
            <description><![CDATA[Rspack 1.2 has been released, introducing experimental persistent caching, a faster code splitting algorithm, and Yarn PnP support.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>January 21, 2025</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-12"><a href="#announcing-rspack-12" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 1.2<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-2.png" alt="Rspack 1.2"/></p>
<blockquote>
<p>Posted by <a href="https://github.com/jerrykingxyz" target="_blank" rel="noopener noreferrer" class="rp-link">@jerrykingxyz</a>, <a href="https://github.com/chenjiahan" target="_blank" rel="noopener noreferrer" class="rp-link">@chenjiahan</a>, <a href="https://github.com/JSerFeng" target="_blank" rel="noopener noreferrer" class="rp-link">@JSerFeng</a>, <a href="https://github.com/ahabhgk" target="_blank" rel="noopener noreferrer" class="rp-link">@ahabhgk</a></p>
</blockquote>
<hr/>
<p>Rspack v1.2 has been released!</p>
<p>Notable changes:</p>
<ul>
<li>New features<!-- -->
<ul>
<li><a href="#persistent-cache" class="rp-link">Persistent cache</a>: An experimental feature that improves hot start performance by up to <strong>250%</strong>.</li>
<li><a href="#yarn-pnp" class="rp-link">Yarn PnP</a></li>
</ul>
</li>
<li>Performance improvements<!-- -->
<ul>
<li><a href="#faster-code-splitting" class="rp-link">Faster code splitting</a>: An experimental flag that significantly improve the code splitting performance.</li>
<li><a href="#watch-scope-change" class="rp-link">Watch scope change</a></li>
<li><a href="#reduced-memory-usage" class="rp-link">Reduced memory usage</a></li>
<li><a href="#smaller-minification-size" class="rp-link">Smaller minification size</a></li>
<li><a href="#faster-side-effects-optimization" class="rp-link">Faster side effects optimization</a></li>
</ul>
</li>
<li>Ecosystem<!-- -->
<ul>
<li><a href="#angular-support" class="rp-link">Angular support</a></li>
<li><a href="#rsbuild-v1-2" class="rp-link">Rsbuild v1.2</a></li>
</ul>
</li>
</ul>
<h2 class="rp-toc-include" id="new-features"><a href="#new-features" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New features</h2>
<h3 class="rp-toc-include" id="persistent-cache"><a href="#persistent-cache" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Persistent cache</h3>
<p>Rspack v1.2 introduced an experimental cache configuration that supports persistent caching, which can significantly improve hot startup speed.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  cache</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    cache</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      type</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;persistent&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>When a build hits the cache, it can bring up to 250% performance improvement in real projects.</p>
<div class="rp-table-scroll-container rp-scrollbar"><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></div>
<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/cache" class="rp-link">cache</a> for more details.</p>
</blockquote>
<h3 class="rp-toc-include" id="yarn-pnp"><a href="#yarn-pnp" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Yarn PnP</h3>
<p>Rspack has added support for <a href="https://yarnpkg.com/features/pnp" target="_blank" rel="noopener noreferrer" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  resolve</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    pnp</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>Special thanks to <a href="https://x.com/arcanis" target="_blank" rel="noopener noreferrer" class="rp-link">@arcanis</a>, the lead maintainer for Yarn, for implementing PnP resolution in the Rspack resolver.</p>
<blockquote>
<p>See <a href="/config/resolve#resolvepnp" class="rp-link">resolve.pnp</a> for more details.</p>
</blockquote>
<h2 class="rp-toc-include" id="performance-improvements"><a href="#performance-improvements" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Performance improvements</h2>
<h3 class="rp-toc-include" id="faster-code-splitting"><a href="#faster-code-splitting" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Faster code splitting</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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    parallelCodeSplitting</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>See <a href="/config/experiments#experimentsparallelcodesplitting" class="rp-link">experiments.parallelCodeSplitting</a> for more details.</p>
</blockquote>
<h3 class="rp-toc-include" id="watch-scope-change"><a href="#watch-scope-change" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Watch scope change</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" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  watchOptions</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ignored</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> []</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>See <a href="/config/watch#watchoptionsignored" class="rp-link">watchOptions.ignored</a> for more details.</p>
</blockquote>
<h3 class="rp-toc-include" id="reduced-memory-usage"><a href="#reduced-memory-usage" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Reduced memory usage</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" class="rp-link">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" class="rp-link">perf: reduce memory consumption of CachedSource</a> for more details.</p>
</blockquote>
<h3 class="rp-toc-include" id="smaller-minification-size"><a href="#smaller-minification-size" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Smaller minification size</h3>
<p>Rspack v1.2 set default SWC minimizer <code>passes</code> to <code>2</code> to reduce bundle size by 1%-7%.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.SwcJsMinimizerRspackPlugin</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  minimizerOptions</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    compress</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">      // Defaults to 1 in previous versions</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      passes</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> 2</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p><a href="https://swc.rs/docs/configuration/minification#jscminifycompress" target="_blank" rel="noopener noreferrer" class="rp-link">passes</a> is the maximum number of times to run compress. In some cases, more than one pass leads to further compressed code. Given Rspack&#x27;s inherent speed, we&#x27;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" class="rp-link">feat: set default SWC minimizer passes to 2 to reduce bundle size</a> for more details.</p>
</blockquote>
<h3 class="rp-toc-include" id="faster-side-effects-optimization"><a href="#faster-side-effects-optimization" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Faster side effects optimization</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" class="rp-link">perf: parallelize side effects optimization</a> for more details.</p>
</blockquote>
<h2 class="rp-toc-include" id="ecosystem"><a href="#ecosystem" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Ecosystem</h2>
<h3 class="rp-toc-include" id="angular-support"><a href="#angular-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Angular support</h3>
<p>Nx team core member <a href="https://github.com/Coly010" target="_blank" rel="noopener noreferrer" class="rp-link">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://nx.dev/docs/technologies/angular/angular-rspack" target="_blank" rel="noopener noreferrer" class="rp-link">Angular Rspack</a> for more information.</p>
<h3 class="rp-toc-include" id="rsbuild-v12"><a href="#rsbuild-v12" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsbuild v1.2</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" class="rp-link">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" class="rp-link">cleanDistPath.keep</a>.</li>
<li><a href="https://rsbuild.rs/plugins/list/plugin-assets-retry" target="_blank" rel="noopener noreferrer" class="rp-link">@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" class="rp-link">Rsbuild v1.2.0</a>.</p>
</blockquote>
<h2 class="rp-toc-include" id="upgrade-guide"><a href="#upgrade-guide" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade guide</h2>
<h3 class="rp-toc-include" id="upgrade-swc-plugins"><a href="#upgrade-swc-plugins" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade SWC plugins</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" class="rp-link">FAQ - SWC plugin version mismatch</a>.</p>
<h3 class="rp-toc-include" id="disable-warncasesensitivemodulesplugin-by-default"><a href="#disable-warncasesensitivemodulesplugin-by-default" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Disable WarnCaseSensitiveModulesPlugin by default</h3>
<p>The <a href="/plugins/webpack/case-sensitive-plugin" class="rp-link">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 &quot;linter&quot; 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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { rspack } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.WarnCaseSensitiveModulesPlugin</span><span style="color:var(--shiki-foreground)">()]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div><!--/$-->]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 1.1]]></title>
            <link>https://rspack.rs/blog/announcing-1-1</link>
            <guid isPermaLink="false">/blog/announcing-1-1</guid>
            <pubDate>Thu, 07 Nov 2024 16:00:00 GMT</pubDate>
            <description><![CDATA[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.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>November 7, 2024</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-11"><a href="#announcing-rspack-11" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 1.1<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-1.png" alt="Rspack 1.1"/></p>
<blockquote>
<p>Posted by <a href="https://github.com/LingyuCoder" target="_blank" rel="noopener noreferrer" class="rp-link">@LingyuCoder</a>, <a href="https://github.com/ahabhgk" target="_blank" rel="noopener noreferrer" class="rp-link">@ahabhgk</a>, <a href="https://github.com/GiveMe-A-Name" target="_blank" rel="noopener noreferrer" class="rp-link">@GiveMe-A-Name</a>, <a href="https://github.com/9aoy" target="_blank" rel="noopener noreferrer" class="rp-link">@9aoy</a>, <a href="https://github.com/chenjiahan" target="_blank" rel="noopener noreferrer" class="rp-link">@chenjiahan</a></p>
</blockquote>
<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" class="rp-link">Better scheduling strategy</a>: Make Rspack <strong>10% faster</strong> than v1.0.</li>
<li><a href="#new-incremental-rebuild" class="rp-link">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" class="rp-link">Improved HTML Plugin</a>: Refactored the built-in HTML plugin with new features.</li>
<li><a href="#improved-jsdoc" class="rp-link">Improved JSDoc</a>: Added JSDoc for all configuration options.</li>
</ul>
</li>
<li>Ecosystem<!-- -->
<ul>
<li><a href="#docusaurus-faster" class="rp-link">Docusaurus Faster</a>: Use Rspack as the bundler for Docusaurus sites.</li>
<li><a href="#nuxt-rspack-builder" class="rp-link">Nuxt Rspack Builder</a>: Experimental Rspack builder for Nuxt.</li>
</ul>
</li>
<li><a href="#rsbuild-v11" class="rp-link">Rsbuild v1.1</a>: CLI shortcuts and new configurations.</li>
</ul>
<h2 class="rp-toc-include" id="performance-improvements"><a href="#performance-improvements" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Performance improvements</h2>
<h3 class="rp-toc-include" id="better-scheduling-strategy"><a href="#better-scheduling-strategy" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Better scheduling strategy</h3>
<p>According to our benchmarks, Rspack v1.1 is <strong>10% faster</strong> than v1.0.</p>
<img width="850" src="https://assets.rspack.rs/rspack/assets/rspack-1-1-perf-comparison.png" alt="Rspack v1.1 vs v1.0"/>
<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" class="rp-link">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 class="rp-toc-include" id="new-incremental-rebuild"><a href="#new-incremental-rebuild" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New incremental rebuild</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" class="rp-link">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" class="rp-link">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>
<img width="850" src="https://assets.rspack.rs/rspack/assets/rspack-v1-1-new-incremental-compare.png" alt="10000 React Components with new incremental enabled"/>
<p>In Rspack v1.1 you can enable this feature in development mode by:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> isDev</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-constant)"> process</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">env</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">NODE_ENV</span><span style="color:var(--shiki-token-keyword)"> ===</span><span style="color:var(--shiki-token-string-expression)"> &#x27;development&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  mode</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> isDev </span><span style="color:var(--shiki-token-keyword)">?</span><span style="color:var(--shiki-token-string-expression)"> &#x27;development&#x27;</span><span style="color:var(--shiki-token-keyword)"> :</span><span style="color:var(--shiki-token-string-expression)"> &#x27;production&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    incremental</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> isDev</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>See <a href="/config/experiments#experimentsincremental" class="rp-link">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" class="rp-link">#8106</a>.</p>
<h2 class="rp-toc-include" id="new-features"><a href="#new-features" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New features</h2>
<h3 class="rp-toc-include" id="improved-html-plugin"><a href="#improved-html-plugin" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved HTML plugin</h3>
<p>In earlier versions of Rspack, the built-in <a href="/plugins/rspack/html-rspack-plugin" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> DeferPlugin</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">  apply</span><span style="color:var(--shiki-foreground)">(compiler) {</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">    compiler</span><span style="color:var(--shiki-token-function)">.</span><span style="color:var(--shiki-token-constant)">hooks</span><span style="color:var(--shiki-token-function)">.</span><span style="color:var(--shiki-token-constant)">compilation</span><span style="color:var(--shiki-token-function)">.tap</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;DeferPlugin&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> (compilation) </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">      const</span><span style="color:var(--shiki-token-constant)"> hooks</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-constant)"> HtmlRspackPlugin</span><span style="color:var(--shiki-token-function)">.getCompilationHooks</span><span style="color:var(--shiki-foreground)">(compilation);</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">      hooks</span><span style="color:var(--shiki-token-function)">.</span><span style="color:var(--shiki-token-constant)">alterAssetTags</span><span style="color:var(--shiki-token-function)">.tapPromise</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;DeferPlugin&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-keyword)"> async</span><span style="color:var(--shiki-foreground)"> (data) </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">        // Add `defer` attribute to all script tags</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">        for</span><span style="color:var(--shiki-foreground)"> (</span><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> tag</span><span style="color:var(--shiki-token-keyword)"> of</span><span style="color:var(--shiki-token-constant)"> data</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">assetTags</span><span style="color:var(--shiki-foreground)">.scripts) {</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">          if</span><span style="color:var(--shiki-foreground)"> (</span><span style="color:var(--shiki-token-constant)">tag</span><span style="color:var(--shiki-foreground)">.tagName </span><span style="color:var(--shiki-token-keyword)">===</span><span style="color:var(--shiki-token-string-expression)"> &#x27;script&#x27;</span><span style="color:var(--shiki-foreground)">) {</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">            tag</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">attributes</span><span style="color:var(--shiki-foreground)">.defer </span><span style="color:var(--shiki-token-keyword)">=</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      });</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    });</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-function)"> HtmlRspackPlugin</span><span style="color:var(--shiki-foreground)">()</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> DeferPlugin]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>See <a href="/plugins/rspack/html-rspack-plugin" class="rp-link">HtmlRspackPlugin</a> for more details.</p>
</blockquote>
<h3 class="rp-toc-include" id="improved-jsdoc"><a href="#improved-jsdoc" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved JSDoc</h3>
<p>Rspack uses <a href="https://github.com/colinhacks/zod" target="_blank" rel="noopener noreferrer" class="rp-link">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>
<img width="850" src="https://assets.rspack.rs/rspack/assets/rspack-v1-1-config-intellisense.png" alt="configuration intellisense in IDE"/>
<blockquote>
<p>We&#x27;re still looking to improve the JSDoc. If you&#x27;re interested, feel free to submit pull requests. ❤️</p>
</blockquote>
<h2 class="rp-toc-include" id="ecosystem"><a href="#ecosystem" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Ecosystem</h2>
<h3 class="rp-toc-include" id="docusaurus-faster"><a href="#docusaurus-faster" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Docusaurus Faster</h3>
<p><a href="https://docusaurus.io/blog/releases/3.6" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">Docusaurus Faster</a> project&#x27;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 class="rp-toc-include" id="nuxt-rspack-builder"><a href="#nuxt-rspack-builder" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Nuxt Rspack builder</h3>
<p><a href="https://nuxt.com/blog/v3-14" target="_blank" rel="noopener noreferrer" class="rp-link">Nuxt v3.14</a> brings a new first-class Nuxt builder for Rspack.</p>
<p>It&#x27;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" class="rp-link">nuxt-rspack-starter</a> to get started, or install <a href="https://www.npmjs.com/package/@nuxt/rspack-builder" target="_blank" rel="noopener noreferrer" class="rp-link">@nuxt/rspack-builder</a> and set <code>builder: &#x27;rspack&#x27;</code> in the Nuxt config file.</p>
<h2 class="rp-toc-include" id="rsbuild-v11"><a href="#rsbuild-v11" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsbuild v1.1</h2>
<p>Rsbuild v1.1 upgraded to Rspack v1.1 and introduced several new features.</p>
<h3 class="rp-toc-include" id="cli-shortcuts"><a href="#cli-shortcuts" class="rp-header-anchor rp-link" aria-hidden="true">#</a>CLI shortcuts</h3>
<p>Rsbuild now supports enabling CLI shortcuts through the <a href="https://rsbuild.rs/config/dev/cli-shortcuts" target="_blank" rel="noopener noreferrer" class="rp-link">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>
<img width="650" src="https://assets.rspack.rs/rsbuild/assets/rsbuild-cli-shortcuts.png" alt="Rsbuild CLI shortcuts"/>
<h3 class="rp-toc-include" id="view-static-assets"><a href="#view-static-assets" class="rp-header-anchor rp-link" aria-hidden="true">#</a>View static assets</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>
<img src="https://assets.rspack.rs/rsbuild/assets/assets-report-page.png" alt="rsbuild-dev-server" width="600"/>
<h3 class="rp-toc-include" id="new-configurations"><a href="#new-configurations" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New configurations</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" class="rp-link">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" class="rp-link">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" class="rp-link">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" class="rp-link">output.distPath.assets</a>: Set the output directory of other static assets.</li>
</ul>
<h2 class="rp-toc-include" id="upgrade-guide"><a href="#upgrade-guide" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade guide</h2>
<h3 class="rp-toc-include" id="upgrade-swc-plugins"><a href="#upgrade-swc-plugins" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade SWC plugins</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" class="rp-link">SWC documentation</a>.</p>
<h3 class="rp-toc-include" id="hash-function"><a href="#hash-function" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Hash function</h3>
<p>Rspack&#x27;s <a href="/config/output#outputhashfunction" class="rp-link">output.hashFunction</a> now defaults to the faster <code>xxhash64</code>, and the <a href="/config/output#outputhashdigestlength" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  output</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    hashFunction</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;md5&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    hashDigestLength</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> 20</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<blockquote>
<p>Related PR: <a href="https://github.com/web-infra-dev/rspack/pull/8249" target="_blank" rel="noopener noreferrer" class="rp-link">#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 isPermaLink="false">/blog/announcing-1-0-alpha</guid>
            <pubDate>Sat, 29 Jun 2024 16:00:00 GMT</pubDate>
            <description><![CDATA[Rspack 1.0 alpha is now available on npm! 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.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>June 29, 2024</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-10-alpha"><a href="#announcing-rspack-10-alpha" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 1.0 alpha<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-0-alpha.png" alt=""/></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 class="rp-toc-include" id="outputs-optimization"><a href="#outputs-optimization" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Outputs optimization</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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  optimization</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">    // Now enabled by default in production</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    concatenateModules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> mode </span><span style="color:var(--shiki-token-keyword)">===</span><span style="color:var(--shiki-token-string-expression)"> &#x27;production&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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 class="rp-toc-include" id="builtin-lightning-css"><a href="#builtin-lightning-css" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Builtin Lightning CSS</h2>
<p>Rspack 1.0 has built-in integration with <a href="https://github.com/parcel-bundler/lightningcss" target="_blank" rel="noopener noreferrer" class="rp-link">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>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  optimization: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    minimizer: [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      // The default CSS minimizer changed:</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-     new rspack.SwcCssMinimizerRspackPlugin()</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+     new rspack.LightningCssMinimizerRspackPlugin()</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>You can switch back to <code>SwcCssMinimizerRspackPlugin</code> by following configuration.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  optimization</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    minimizer</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">      new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.SwcJsMinimizerRspackPlugin</span><span style="color:var(--shiki-foreground)">()</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">      new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.SwcCssMinimizerRspackPlugin</span><span style="color:var(--shiki-foreground)">()</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">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" class="rp-link">@devongovett</a> for creating such an excellent tool.</p>
<h2 class="rp-toc-include" id="lean-core"><a href="#lean-core" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Lean core</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" class="rp-link">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" class="rp-link">@swc/plugin-emotion</a></li>
<li><a href="https://www.npmjs.com/package/@swc/plugin-relay" target="_blank" rel="noopener noreferrer" class="rp-link">@swc/plugin-relay</a></li>
<li><a href="https://www.npmjs.com/package/@swc/plugin-styled-components" target="_blank" rel="noopener noreferrer" class="rp-link">@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>
<div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="bash"><code><span class="line"><span style="color:var(--shiki-token-function)">npm</span><span style="color:var(--shiki-token-string)"> i</span><span style="color:var(--shiki-token-string)"> @swc/plugin-styled-components</span><span style="color:var(--shiki-token-string)"> -D</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<ul>
<li>Configuration:</li>
</ul>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff"><code><span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules: [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test: /\.jsx?$/,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        loader: &quot;builtin:swc-loader&quot;,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        options: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-         rspackExperiments: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-           styledComponents: {},</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-         },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          jsc: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+           experimental: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+             plugins: [[&quot;@swc/plugin-styled-components&quot;, {}]],</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+           },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h2 class="rp-toc-include" id="bundling-css"><a href="#bundling-css" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Bundling CSS</h2>
<p>Rspack 1.0 aligns with the webpack <a href="/config/experiments#experimentscss" class="rp-link">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" class="rp-link">css-loader</a> and <a href="https://github.com/webpack/mini-css-extract-plugin" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">css-loader</a> and <a href="https://github.com/webpack/style-loader" target="_blank" rel="noopener noreferrer" class="rp-link">style-loader</a> to inject CSS through <code>&lt;style&gt;</code> tags.</li>
<li>Use <a href="/config/experiments#experimentscss" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    css</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h2 class="rp-toc-include" id="how-to-upgrade"><a href="#how-to-upgrade" class="rp-header-anchor rp-link" aria-hidden="true">#</a>How to upgrade</h2>
<p>To install the alpha version of Rspack and Rspack CLI:</p>
<div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="bash"><code><span class="line"><span style="color:var(--shiki-token-comment)"># npm</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">npm</span><span style="color:var(--shiki-token-string)"> add</span><span style="color:var(--shiki-token-string)"> -D</span><span style="color:var(--shiki-token-string)"> --save-exact</span><span style="color:var(--shiki-token-string)"> @rspack/core@alpha</span><span style="color:var(--shiki-token-string)"> @rspack/cli@alpha</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)"># yarn</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">yarn</span><span style="color:var(--shiki-token-string)"> add</span><span style="color:var(--shiki-token-string)"> -D</span><span style="color:var(--shiki-token-string)"> --save-exact</span><span style="color:var(--shiki-token-string)"> @rspack/core@alpha</span><span style="color:var(--shiki-token-string)"> @rspack/cli@alpha</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)"># pnpm</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">pnpm</span><span style="color:var(--shiki-token-string)"> add</span><span style="color:var(--shiki-token-string)"> -D</span><span style="color:var(--shiki-token-string)"> --save-exact</span><span style="color:var(--shiki-token-string)"> @rspack/core@alpha</span><span style="color:var(--shiki-token-string)"> @rspack/cli@alpha</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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 class="rp-toc-include" id="breaking-changes"><a href="#breaking-changes" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Breaking changes</h2>
<h3 class="rp-toc-include" id="resolvetsconfigpath"><a href="#resolvetsconfigpath" class="rp-header-anchor rp-link" aria-hidden="true">#</a>resolve.tsConfigPath</h3>
<p><code>resolve.tsConfigPath</code> config has been removed, please use <a href="/config/resolve#resolvetsconfig" class="rp-link">resolve.tsConfig</a> instead.</p>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  resolve: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-   tsConfigPath: path.resolve(__dirname, &#x27;./tsconfig.json&#x27;),</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+   tsConfig: path.resolve(__dirname, &#x27;./tsconfig.json&#x27;),</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="rspackexperimentsstyledcomponents"><a href="#rspackexperimentsstyledcomponents" class="rp-header-anchor rp-link" aria-hidden="true">#</a>rspackExperiments.styledComponents</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" class="rp-link">@swc/plugin-styled-components</a> instead.</p>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff"><code><span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules: [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test: /\.jsx$/,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        loader: &quot;builtin:swc-loader&quot;,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        options: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-         rspackExperiments: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-           styledComponents: true,</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-         },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          jsc: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+           experimental: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+             plugins: [[&quot;@swc/plugin-styled-components&quot;, {}]],</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+           },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="rspackexperimentsemotion"><a href="#rspackexperimentsemotion" class="rp-header-anchor rp-link" aria-hidden="true">#</a>rspackExperiments.emotion</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" class="rp-link">@swc/plugin-emotion</a> instead.</p>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff"><code><span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules: [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test: /\.jsx$/,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        loader: &quot;builtin:swc-loader&quot;,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        options: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-         rspackExperiments: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-           emotion: true,</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-         },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          jsc: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+           experimental: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+             plugins: [[&quot;@swc/plugin-emotion&quot;, {}]],</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+           },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="rspackexperimentsrelay"><a href="#rspackexperimentsrelay" class="rp-header-anchor rp-link" aria-hidden="true">#</a>rspackExperiments.relay</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" class="rp-link">@swc/plugin-relay</a> instead.</p>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff"><code><span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules: [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test: /\.jsx$/,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        loader: &quot;builtin:swc-loader&quot;,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        options: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-         rspackExperiments: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-           relay: true,</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-         },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          jsc: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+           experimental: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+             plugins: [[&quot;@swc/plugin-relay&quot;, {}]],</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+           },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="others"><a href="#others" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Others</h3>
<p>Other breaking changes:</p>
<ul>
<li><code>optimization.chunkIds</code> defaults to <code>&#x27;natural&#x27;</code> when <code>mode === &#x27;none&#x27;</code>, see <a href="https://github.com/web-infra-dev/rspack/pull/6956" target="_blank" rel="noopener noreferrer" class="rp-link">#6956</a>.</li>
<li><code>optimization.moduleIds</code> defaults to <code>&#x27;natural&#x27;</code> when <code>mode === &#x27;none&#x27;</code>, see <a href="https://github.com/web-infra-dev/rspack/pull/6956" target="_blank" rel="noopener noreferrer" class="rp-link">#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" class="rp-link">#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" class="rp-link">#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" class="rp-link">#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" class="rp-link">#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" class="rp-link">#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 isPermaLink="false">/blog/announcing-1-0</guid>
            <pubDate>Sat, 29 Jun 2024 16:00:00 GMT</pubDate>
            <description><![CDATA[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.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>August 28, 2024</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-10"><a href="#announcing-rspack-10" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 1.0<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v1-0.png" alt=""/></p>
<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&#x27;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"/></p>
<p>Today Rspack has reached a new milestone - 1.0. This means that Rspack is production-ready, covers most of webpack&#x27;s APIs and features, and is now prepared to support more users.</p>
<h2 class="rp-toc-include" id="whos-using-rspack"><a href="#whos-using-rspack" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Who&#x27;s using Rspack</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"/></p>
<p>Within ByteDance, Rspack&#x27;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"/></p>
<h2 class="rp-toc-include" id="new-features"><a href="#new-features" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New features</h2>
<p>Since the release of 0.1, Rspack has introduced numerous important features and optimizations, including:</p>
<h3 class="rp-toc-include" id="better-performance"><a href="#better-performance" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Better performance</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" class="rp-link">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" class="rp-link">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"/></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 class="rp-toc-include" id="better-compatibility"><a href="#better-compatibility" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Better compatibility</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" class="rp-link">@rspack/plugin-html</a>, <a href="https://www.npmjs.com/package/@rspack/plugin-minify" target="_blank" rel="noopener noreferrer" class="rp-link">@rspack/plugin-minify</a>, and <a href="https://www.npmjs.com/package/@rspack/plugin-node-polyfill" target="_blank" rel="noopener noreferrer" class="rp-link">@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" class="rp-link">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" class="rp-link">unplugin</a> and <a href="https://www.npmjs.com/package/node-polyfill-webpack-plugin" target="_blank" rel="noopener noreferrer" class="rp-link">node-polyfill-webpack-plugin</a>. Special thanks to <a href="https://github.com/alexander-akait" target="_blank" rel="noopener noreferrer" class="rp-link">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 class="rp-toc-include" id="smaller-bundle-size"><a href="#smaller-bundle-size" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Smaller bundle size</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" class="rp-link">split chunks</a>, <a href="/guide/optimization/tree-shaking" class="rp-link">tree shaking</a>, <a href="/config/optimization#optimizationconcatenatemodules" class="rp-link">scope hoisting</a> and <a href="/config/optimization#optimizationmangleexports" class="rp-link">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 class="rp-toc-include" id="support-for-module-federation-20"><a href="#support-for-module-federation-20" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Support for Module Federation 2.0</h3>
<p><a href="https://module-federation.io/" target="_blank" rel="noopener noreferrer" class="rp-link">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 class="rp-toc-include" id="stable-api-and-new-website"><a href="#stable-api-and-new-website" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Stable API and new website</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="/" class="rp-link">homepage</a>. Many thanks to designer Emily Jackson and team member <a href="https://github.com/ScriptedAlchemy" target="_blank" rel="noopener noreferrer" class="rp-link">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"/></p>
<h2 class="rp-toc-include" id="why-rspack"><a href="#why-rspack" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Why Rspack</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 &quot;flexibility&quot; and &quot;out-of-the-box&quot; 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 class="rp-toc-include" id="rstack"><a href="#rstack" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rstack</h3>
<p><img src="https://assets.rspack.rs/rspack/assets/rspack-v1-0-rstack.png" alt="Rstack"/></p>
<p>Rstack is short for &quot;Rspack Stack&quot; 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" class="rp-link">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" class="rp-link">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" class="rp-link">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" class="rp-link">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" class="rp-link">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 class="rp-toc-include" id="compatibility-with-webpack"><a href="#compatibility-with-webpack" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Compatibility with webpack</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" class="rp-link">new Worker()</a>, supports importing JSON modules through <a href="https://github.com/tc39/proposal-import-attributes" target="_blank" rel="noopener noreferrer" class="rp-link">Import Attributes</a>, and supports importing CSS based on the <a href="https://web.dev/articles/css-module-scripts" target="_blank" rel="noopener noreferrer" class="rp-link">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 class="rp-toc-include" id="how-to-use-10"><a href="#how-to-use-10" class="rp-header-anchor rp-link" aria-hidden="true">#</a>How to use 1.0</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" class="rp-link">Migration from Rspack 0.x</a>.</p>
<p>If you have never used Rspack before, please see <a href="/guide/start/quick-start" class="rp-link">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" class="rp-link">Rspack GitHub repository</a>.</p>
<h2 class="rp-toc-include" id="whats-next"><a href="#whats-next" class="rp-header-anchor rp-link" aria-hidden="true">#</a>What&#x27;s next</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" class="rp-link">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" class="rp-link">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" class="rp-link">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" class="rp-link">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 class="rp-toc-include" id="faster-hmr"><a href="#faster-hmr" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Faster HMR</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 class="rp-toc-include" id="portable-cache"><a href="#portable-cache" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Portable cache</h3>
<p>The evolution path of Rspack&#x27;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&#x27;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 class="rp-toc-include" id="typescript-based-optimization"><a href="#typescript-based-optimization" class="rp-header-anchor rp-link" aria-hidden="true">#</a>TypeScript-based optimization</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&#x27;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" class="rp-link">type-based property renaming</a>).</p>
<h3 class="rp-toc-include" id="stable-rust-api"><a href="#stable-rust-api" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Stable Rust API</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" class="rp-link">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&#x27;s Rust API for integration.</p>
<h3 class="rp-toc-include" id="react-server-components-support"><a href="#react-server-components-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>React Server Components support</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" class="rp-link">layer</a> feature, which allows to build for multiple environments in a single run.</p>
<h3 class="rp-toc-include" id="improved-esm-output"><a href="#improved-esm-output" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved ESM output</h3>
<p>ESM is the standard for JavaScript modules. We are currently improving Rspack and webpack&#x27;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&#x27;s static analysis and tree-shaking when building npm packages.</p>
<h2 class="rp-toc-include" id="acknowledgements"><a href="#acknowledgements" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Acknowledgements</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" class="rp-link">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" class="rp-link">Zack Chapple</a> and the <a href="https://www.zephyr-cloud.io/" target="_blank" rel="noopener noreferrer" class="rp-link">Zephyr team</a> for helping to promote Rspack.</li>
<li>The <a href="https://github.com/unjs/unplugin" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">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" class="rp-link">Kaffi Y</a> for tirelessly helping users and answering Rspack-related questions on GitHub and Discord.</li>
<li>All the developers participating in ByteDance&#x27;s Rspack Innovator project, such as <a href="https://x.com/Dominus_Kelvin" target="_blank" rel="noopener noreferrer" class="rp-link">Kelvin Omereshone</a>, <a href="https://x.com/_yanpes" target="_blank" rel="noopener noreferrer" class="rp-link">Yannik Peschke</a>, <a href="https://x.com/RussellCanfield" target="_blank" rel="noopener noreferrer" class="rp-link">Russell Canfield</a>, and <a href="https://x.com/KyryloBashtenko" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">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"/></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" class="rp-link">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" class="rp-link">kdy</a> for his review feedback.</li>
<li>Rspack has embraced the <a href="https://github.com/unjs/unplugin" target="_blank" rel="noopener noreferrer" class="rp-link">unplugin</a> ecosystem and fully supports the unplugin API. Thanks to <a href="https://github.com/sxzz" target="_blank" rel="noopener noreferrer" class="rp-link">sxzz</a> for his review feedback and <a href="https://github.com/antfu" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">Bazel</a>, <a href="https://github.com/rstackjs/storybook-rsbuild" target="_blank" rel="noopener noreferrer" class="rp-link">Storybook</a>, <a href="https://github.com/noshower/electron-forge-plugin-rspack" target="_blank" rel="noopener noreferrer" class="rp-link">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"/></p>
<h2 class="rp-toc-include" id="faq"><a href="#faq" class="rp-header-anchor rp-link" aria-hidden="true">#</a>FAQ</h2>
<h3 class="rp-toc-include" id="what-does-the-10-release-mean"><a href="#what-does-the-10-release-mean" class="rp-header-anchor rp-link" aria-hidden="true">#</a>What does the 1.0 release mean?</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" class="rp-link">future flags</a>.</p>
<h3 class="rp-toc-include" id="when-will-rsbuild-10-be-released"><a href="#when-will-rsbuild-10-be-released" class="rp-header-anchor rp-link" aria-hidden="true">#</a>When will Rsbuild 1.0 be released?</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" class="rp-link">Migrating from Rsbuild 0.x</a> to upgrade to Rsbuild 1.0 RC.</p>
<h3 class="rp-toc-include" id="does-rspack-follow-semantic-versioning"><a href="#does-rspack-follow-semantic-versioning" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Does Rspack follow semantic versioning?</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 class="rp-toc-include" id="experimental-features"><a href="#experimental-features" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Experimental features</h4>
<p>Rspack provides some experimental features that can be used via the <a href="/config/experiments" class="rp-link">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 class="rp-toc-include" id="swc-related-features"><a href="#swc-related-features" class="rp-header-anchor rp-link" aria-hidden="true">#</a>SWC related features</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&#x27;t contain any breaking changes, we may upgrade SWC in a patch or minor release.</p>
<h4 class="rp-toc-include" id="types"><a href="#types" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Types</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 class="rp-toc-include" id="bugfix-for-webpack-compatibility"><a href="#bugfix-for-webpack-compatibility" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Bugfix for webpack compatibility</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&#x27;s behavior.</p><!--/$-->]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Announcing Rspack 0.7]]></title>
            <link>https://rspack.rs/blog/announcing-0-7</link>
            <guid isPermaLink="false">/blog/announcing-0-7</guid>
            <pubDate>Tue, 28 May 2024 16:00:00 GMT</pubDate>
            <description><![CDATA[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.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>May 28, 2024</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-07"><a href="#announcing-rspack-07" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 0.7<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<p><img src="https://assets.rspack.rs/rspack/rspack-banner-v0-7.png" alt=""/></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" class="rp-link">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" class="rp-link">Faster CSS Build</a>: Introducing a new css-module-lexer, which increases CSS bundling speed by 4 times.</li>
<li><a href="#breaking-changes" class="rp-link">Breaking changes</a>: Removed some unstable APIs to make default behaviors more consistent with webpack.</li>
</ul>
<h2 class="rp-toc-include" id="support-for-lazy-compilation"><a href="#support-for-lazy-compilation" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Support for lazy compilation</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 class="rp-toc-include" id="what-is-lazy-compilation"><a href="#what-is-lazy-compilation" class="rp-header-anchor rp-link" aria-hidden="true">#</a>What is lazy compilation</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 class="rp-toc-include" id="why-need-lazy-compilation"><a href="#why-need-lazy-compilation" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Why need lazy compilation</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&#x27;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 &quot;entry points&quot; and &quot;dynamic imports&quot; as split points. For example:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">src/a.js</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="src/a.js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">if</span><span style="color:var(--shiki-foreground)"> (someCondition) {</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">  import</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./b.js&#x27;</span><span style="color:var(--shiki-foreground)">);</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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"/></p>
<h3 class="rp-toc-include" id="how-to-use"><a href="#how-to-use" class="rp-header-anchor rp-link" aria-hidden="true">#</a>How to use</h3>
<p>Now, you can enable the lazy compilation feature in Rspack through the <a href="/config/experiments#experimentslazycompilation" class="rp-link">experiments.lazyCompilation</a> configuration:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">const</span><span style="color:var(--shiki-token-constant)"> isDev</span><span style="color:var(--shiki-token-keyword)"> =</span><span style="color:var(--shiki-token-constant)"> process</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">env</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">NODE_ENV</span><span style="color:var(--shiki-token-keyword)"> ===</span><span style="color:var(--shiki-token-string-expression)"> &#x27;development&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    lazyCompilation</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> isDev</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">GitHub Issues</a>.</p>
<h2 class="rp-toc-include" id="faster-css-builds"><a href="#faster-css-builds" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Faster CSS builds</h2>
<p>In v0.7, we have refactored the internal implementation of the <a href="/config/experiments#experimentscss" class="rp-link">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" class="rp-link">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&#x27;s <code>css-loader</code>. For example, it can support the following CSS Modules syntax:</p>
<div class="rp-codeblock language-css"><div class="rp-codeblock__title">style.module.css</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="css" data-title="style.module.css"><code><span class="line"><span style="color:var(--shiki-foreground)">:local(</span><span style="color:var(--shiki-token-function)">.parent</span><span style="color:var(--shiki-foreground)">):global(</span><span style="color:var(--shiki-token-function)">.child</span><span style="color:var(--shiki-foreground)">) </span><span style="color:var(--shiki-token-keyword)">&gt;</span><span style="color:var(--shiki-token-string-expression)"> ul</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">  color</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> red</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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"/></p>
<p><code>css-module-lexer</code> has also brought significant performance improvements to Rspack&#x27;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 class="rp-toc-include" id="breaking-changes"><a href="#breaking-changes" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Breaking changes</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 class="rp-toc-include" id="deprecating-unstable-javascript-apis"><a href="#deprecating-unstable-javascript-apis" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Deprecating unstable JavaScript APIs</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" class="rp-link">rspack#6448</a>, <a href="https://github.com/web-infra-dev/rspack/pull/6505" target="_blank" rel="noopener noreferrer" class="rp-link">rspack#6505</a>.</p>
<h3 class="rp-toc-include" id="css-import-rules-must-precede-all-other-rules"><a href="#css-import-rules-must-precede-all-other-rules" class="rp-header-anchor rp-link" aria-hidden="true">#</a>CSS @import rules must precede all other rules</h3>
<p>In Rspack 0.7, we have partially refactored the internal implementation of <a href="/config/experiments#experimentscss" class="rp-link">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>
<div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="bash"><code><span class="line"><span style="color:var(--shiki-token-function)">ERROR</span><span style="color:var(--shiki-token-string)"> in</span><span style="color:var(--shiki-token-string)"> ./src/main.css</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">  ×</span><span style="color:var(--shiki-token-string)"> Module</span><span style="color:var(--shiki-token-string)"> parse</span><span style="color:var(--shiki-token-string)"> failed:</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">  ╰─▶</span><span style="color:var(--shiki-token-string)">   ×</span><span style="color:var(--shiki-token-string)"> CSS</span><span style="color:var(--shiki-token-string)"> parsing</span><span style="color:var(--shiki-token-string)"> warning:</span><span style="color:var(--shiki-token-string)"> Any</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@import&#x27;</span><span style="color:var(--shiki-token-string)"> rules</span><span style="color:var(--shiki-token-string)"> must</span><span style="color:var(--shiki-token-string)"> precede</span><span style="color:var(--shiki-token-string)"> all</span><span style="color:var(--shiki-token-string)"> other</span><span style="color:var(--shiki-token-string)"> rules</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">         ╭─[4:1]</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">       4</span><span style="color:var(--shiki-token-string)"> │</span><span style="color:var(--shiki-token-string)"> }</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">       5</span><span style="color:var(--shiki-token-string)"> │</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">       6</span><span style="color:var(--shiki-token-string)"> │</span><span style="color:var(--shiki-token-string)"> @import</span><span style="color:var(--shiki-token-string-expression)"> &#x27;bootstrap/dist/css/bootstrap.css&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">         ·</span><span style="color:var(--shiki-token-string)"> ───────</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">       7</span><span style="color:var(--shiki-token-string)"> │</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">       8</span><span style="color:var(--shiki-token-string)"> │</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">         ╰────</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-function)">  help:</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">        You</span><span style="color:var(--shiki-token-string)"> may</span><span style="color:var(--shiki-token-string)"> need</span><span style="color:var(--shiki-token-string)"> an</span><span style="color:var(--shiki-token-string)"> appropriate</span><span style="color:var(--shiki-token-string)"> loader</span><span style="color:var(--shiki-token-string)"> to</span><span style="color:var(--shiki-token-string)"> handle</span><span style="color:var(--shiki-token-string)"> this</span><span style="color:var(--shiki-token-string)"> file</span><span style="color:var(--shiki-token-string)"> type.</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="remove-builtins-and-experimentsrspackfuturenewtreeshaking"><a href="#remove-builtins-and-experimentsrspackfuturenewtreeshaking" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove builtins and experiments.rspackFuture.newTreeshaking</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 class="rp-toc-include" id="remove-resolvebrowserfield"><a href="#remove-resolvebrowserfield" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove resolve.browserField</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 class="rp-toc-include" id="remove-experimentsnewsplitchunks"><a href="#remove-experimentsnewsplitchunks" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove experiments.newSplitChunks</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 class="rp-toc-include" id="remove-snapshot"><a href="#remove-snapshot" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove snapshot</h3>
<p>This configuration is used to control the snapshot strategy when using cache. Under Rspack&#x27;s current incremental rebuild architecture, cache no longer relies on snapshot, so this configuration is no longer needed.</p>
<h3 class="rp-toc-include" id="remove-exportsconvention-for-module-type-css"><a href="#remove-exportsconvention-for-module-type-css" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove exportsConvention for module type css</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 class="rp-toc-include" id="upgrade-swc-to-091x"><a href="#upgrade-swc-to-091x" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade SWC to 0.91.x</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 class="rp-toc-include" id="migration-guide"><a href="#migration-guide" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Migration guide</h2>
<h3 class="rp-toc-include" id="upgrade-the-swc-plugins"><a href="#upgrade-the-swc-plugins" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade the SWC plugins</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" class="rp-link">document</a> of SWC.</p>
<h3 class="rp-toc-include" id="replace-resolvebrowserfield-with-resolvealiasfields"><a href="#replace-resolvebrowserfield-with-resolvealiasfields" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Replace resolve.browserField with resolve.aliasFields</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 class="rp-toc-include" id="remove-generatorcssexportsconvention"><a href="#remove-generatorcssexportsconvention" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove generator.css.exportsConvention</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 class="rp-toc-include" id="rsbuild-v07"><a href="#rsbuild-v07" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsbuild v0.7</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" class="rp-link">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 isPermaLink="false">/blog/announcing-0-6</guid>
            <pubDate>Wed, 10 Apr 2024 16:00:00 GMT</pubDate>
            <description><![CDATA[Rspack 0.6 is out, with built-in support for mini-css-extract-plugin and new tree-shaking enabled by default.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>April 10, 2024</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-06"><a href="#announcing-rspack-06" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 0.6<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<h2 class="rp-toc-include" id="major-feature-updates"><a href="#major-feature-updates" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Major feature updates</h2>
<h3 class="rp-toc-include" id="built-in-support-for-mini-css-extract-plugin"><a href="#built-in-support-for-mini-css-extract-plugin" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Built-in support for mini-css-extract-plugin</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" class="rp-link">CssExtractRspackPlugin</a>.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { rspack } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.CssExtractRspackPlugin</span><span style="color:var(--shiki-foreground)">()]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.css</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-keyword)">i</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        use</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-constant)">rspack</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">CssExtractRspackPlugin</span><span style="color:var(--shiki-foreground)">.loader</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-string-expression)"> &#x27;css-loader&#x27;</span><span style="color:var(--shiki-foreground)">]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">project example</a>.</p>
</blockquote>
<h3 class="rp-toc-include" id="enable-new-tree-shaking-by-default"><a href="#enable-new-tree-shaking-by-default" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Enable new tree shaking by default</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&#x27;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&#x27;t handle circular references and couldn&#x27;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&#x27;ve decided to default-enable the new tree shaking algorithm in version 0.6.0.</p>
<h2 class="rp-toc-include" id="breaking-changes"><a href="#breaking-changes" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Breaking changes</h2>
<h3 class="rp-toc-include" id="remove-experimentsrspackfuturedisableapplyentrylazily"><a href="#remove-experimentsrspackfuturedisableapplyentrylazily" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove experiments.rspackFuture.disableApplyEntryLazily</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 class="rp-toc-include" id="remove-compilerbuild-and-compilerrebuild"><a href="#remove-compilerbuild-and-compilerrebuild" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove compiler.build and compiler.rebuild</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 class="rp-toc-include" id="remove-builtinscss-and-introduce-css-related-moduleparser-and-modulegenerator-options"><a href="#remove-builtinscss-and-introduce-css-related-moduleparser-and-modulegenerator-options" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove builtins.css and introduce CSS related module.parser and module.generator options</h3>
<p>Remove <code>builtins.css</code>, please replace it with the CSS-related <a href="/config/module#moduleparsercssauto" class="rp-link"><code>module.parser</code></a> and <a href="/config/module#modulegeneratorcssauto" class="rp-link"><code>module.generator</code></a> options that have been introduced.</p>
<p>Also, starting from v0.6.0, Rspack&#x27;s experiments CSS will align with webpack&#x27;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" class="rp-link">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" class="rp-link"><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" class="rp-link">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>&#x27;asIs&#x27;</code>, <code>&#x27;camelCaseOnly&#x27;</code>, etc., to <code>&#x27;as-is&#x27;</code>, <code>&#x27;camel-case-only&#x27;</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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-comment)">// Before v0.6.0, only default export was supported</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> classes </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./index.module.css&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Now, in addition to default export, it also supports:</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Namespace exports</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-token-constant)"> *</span><span style="color:var(--shiki-token-keyword)"> as</span><span style="color:var(--shiki-foreground)"> classes </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./index.module.css&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Named exports</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { class1</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> class2 } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./index.module.css&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Default and named exports used together</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> classes</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> { class1</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> class2 } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./index.module.css&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
</li>
<li>
<p>The default value of <code>namedExports</code> changed from <code>false</code> to <code>true</code>, meaning you&#x27;ll have to use a namespace import (like <code>import * as classes from &#x27;./style.css&#x27;</code>) or named import (like <code>import { class1 } from &#x27;./style.css&#x27;</code>) by default, which will improve future compatibility with <a href="https://web.dev/articles/css-module-scripts" target="_blank" rel="noopener noreferrer" class="rp-link">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>&#x27;[path][name][ext]__[local]&#x27;</code> in development mode and <code>&#x27;[hash]&#x27;</code> in production mode to <code>&#x27;[uniqueName]-[id]-[local]&#x27;</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: &#x27;node&#x27;</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" class="rp-link">CSS Modules</a>, consistent with <a href="https://github.com/webpack/css-loader?tab=readme-ov-file#auto" target="_blank" rel="noopener noreferrer" class="rp-link"><code>css-loader</code>&#x27;s <code>modules.auto: true</code></a>, which will <a href="https://github.com/webpack/webpack/issues/16572" target="_blank" rel="noopener noreferrer" class="rp-link">simplify the writing rules for using less or sass with CSS Modules</a>.</p>
</li>
</ol>
<h3 class="rp-toc-include" id="upgrade-swc-to-090x"><a href="#upgrade-swc-to-090x" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade SWC to 0.90.x</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 class="rp-toc-include" id="emit-warnings-when-css-order-is-inconsistent-in-multiple-chunks"><a href="#emit-warnings-when-css-order-is-inconsistent-in-multiple-chunks" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Emit warnings when CSS order is inconsistent in multiple chunks</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>
<div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="bash"><code><span class="line"><span style="color:var(--shiki-token-function)">WARNING</span><span style="color:var(--shiki-token-string)"> in</span><span style="color:var(--shiki-token-string)"> ⚠</span><span style="color:var(--shiki-token-string)"> chunk</span><span style="color:var(--shiki-token-string)"> src_a_css-src_b_-5c8c53</span><span style="color:var(--shiki-foreground)"> [css-extract-rspack-plugin]</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">  │</span><span style="color:var(--shiki-token-string)"> Conflicting</span><span style="color:var(--shiki-token-string)"> order.</span><span style="color:var(--shiki-token-string)"> Following</span><span style="color:var(--shiki-token-string)"> module</span><span style="color:var(--shiki-token-string)"> has</span><span style="color:var(--shiki-token-string)"> been</span><span style="color:var(--shiki-token-string)"> added:</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">  │</span><span style="color:var(--shiki-token-string)">  *</span><span style="color:var(--shiki-token-string)"> css</span><span style="color:var(--shiki-token-string)"> ./css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./src/a.css</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">  │</span><span style="color:var(--shiki-token-string)"> despite</span><span style="color:var(--shiki-token-string)"> it</span><span style="color:var(--shiki-token-string)"> was</span><span style="color:var(--shiki-token-string)"> not</span><span style="color:var(--shiki-token-string)"> able</span><span style="color:var(--shiki-token-string)"> to</span><span style="color:var(--shiki-token-string)"> fulfill</span><span style="color:var(--shiki-token-string)"> desired</span><span style="color:var(--shiki-token-string)"> ordering</span><span style="color:var(--shiki-token-string)"> with</span><span style="color:var(--shiki-token-string)"> these</span><span style="color:var(--shiki-token-string)"> modules:</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">  │</span><span style="color:var(--shiki-token-string)">  *</span><span style="color:var(--shiki-token-string)"> css</span><span style="color:var(--shiki-token-string)"> ./css-loader/dist/cjs.js??ruleSet[1].rules[2].use[1]!./src/b.css</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">  │</span><span style="color:var(--shiki-token-string)">   -</span><span style="color:var(--shiki-token-string)"> couldn</span><span style="color:var(--shiki-token-string-expression)">&#x27;t fulfill desired order of chunk group(s) parent2</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">  │   - while fulfilling desired order of chunk group(s) parent1</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>If you are sure that their order inconsistency does not matter, you can ignore this error by configuring <code>ignoreWarnings</code>.</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ignoreWarnings</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-string-expression)">/Conflicting order/</span><span style="color:var(--shiki-foreground)">]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h2 class="rp-toc-include" id="migration-guide"><a href="#migration-guide" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Migration guide</h2>
<h3 class="rp-toc-include" id="apply-rspackcssextractrspackplugin"><a href="#apply-rspackcssextractrspackplugin" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Apply rspack.CssExtractRspackPlugin</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>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-inserted)">+ import { rspack } from &#x27;@rspack/core&#x27;;</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">- import CssExtract from &#x27;mini-css-extract-plugin&#x27;;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins: [new rspack.CssExtractRspackPlugin()],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules: [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test: /\.css$/i,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        use: [CssExtract.loader, &#x27;css-loader&#x27;],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="migrate-from-builtinscss"><a href="#migrate-from-builtinscss" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Migrate from builtins.css</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>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+  module: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    generator: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+      &quot;css/auto&quot;: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        exportsOnly: false,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        exportsConvention: &#x27;as-is&#x27;,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        localIdentName: isProduction ? &#x27;[hash]&#x27; : &#x27;[path][name][ext]__[local]&#x27;,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+      },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+      &quot;css&quot;: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        exportsOnly: false,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        exportsConvention: &#x27;as-is&#x27;,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+      },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+      &quot;css/module&quot;: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        exportsOnly: false,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        exportsConvention: &#x27;as-is&#x27;,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        localIdentName: isProduction ? &#x27;[hash]&#x27; : &#x27;[path][name][ext]__[local]&#x27;,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+      },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    parser: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+      &quot;css/auto&quot;: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        namedExports: false,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+      },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+      &quot;css&quot;: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        namedExports: false,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+      },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+      &quot;css/module&quot;: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        namedExports: false,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+      },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+  },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>If it is necessary to configure some modules separately, you can use the <a href="/config/module-rules#rulesparser" class="rp-link"><code>rules[].parser</code></a> and <a href="/config/module-rules#rulesgenerator" class="rp-link"><code>rules[].generator</code></a> options in <code>module.rules</code>.</p>
<h3 class="rp-toc-include" id="migrate-to-compilerrun"><a href="#migrate-to-compilerrun" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Migrate to compiler.run</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 class="rp-toc-include" id="upgrade-the-swc-plugins"><a href="#upgrade-the-swc-plugins" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade the SWC plugins</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" class="rp-link">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 isPermaLink="false">/blog/announcing-0-5</guid>
            <pubDate>Tue, 09 Jan 2024 16:52:00 GMT</pubDate>
            <description><![CDATA[Rspack 0.5 is out, supporting Module Federation and removing the default SWC transformation.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>January 09, 2024</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-05"><a href="#announcing-rspack-05" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 0.5<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<h2 class="rp-toc-include" id="major-feature-updates"><a href="#major-feature-updates" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Major feature updates</h2>
<h3 class="rp-toc-include" id="module-federation-added-to-rspack"><a href="#module-federation-added-to-rspack" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Module Federation added to Rspack</h3>
<p>Checkout <a href="/blog/module-federation-added-to-rspack" class="rp-link">this blog</a> for more details.</p>
<h2 class="rp-toc-include" id="breaking-changes"><a href="#breaking-changes" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Breaking changes</h2>
<h3 class="rp-toc-include" id="optimizationchunkids-is-deterministic-in-production-mode-by-default"><a href="#optimizationchunkids-is-deterministic-in-production-mode-by-default" class="rp-header-anchor rp-link" aria-hidden="true">#</a>optimization.chunkIds is deterministic in production mode by default</h3>
<p><code>optimization.chunkIds</code> is <code>&quot;deterministic&quot;</code> now in production mode, which aligns with webpack&#x27;s default behavior.</p>
<h3 class="rp-toc-include" id="support-rspackhotmodulereplacementplugin"><a href="#support-rspackhotmodulereplacementplugin" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Support rspack.HotModuleReplacementPlugin</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 class="rp-toc-include" id="remove-default-transformation"><a href="#remove-default-transformation" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove default transformation</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" class="rp-link">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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.jsx</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        exclude</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /[\\/]node_modules[\\/]/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        loader</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;builtin:swc-loader&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        options</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          jsc</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            parser</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              syntax</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;ecmascript&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              jsx</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>To transform a <code>.tsx</code> file:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.tsx</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        exclude</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /[\\/]node_modules[\\/]/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        loader</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;builtin:swc-loader&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        options</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          jsc</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            parser</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              syntax</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;typescript&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              tsx</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>To transform a <code>.ts</code> file:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.ts</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        exclude</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /[\\/]node_modules[\\/]/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        loader</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;builtin:swc-loader&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        options</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          jsc</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            parser</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              syntax</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;typescript&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="target-does-not-affect-user-code-anymore"><a href="#target-does-not-affect-user-code-anymore" class="rp-header-anchor rp-link" aria-hidden="true">#</a>target does not affect user code anymore</h3>
<p>Rspack aligns <a href="/config/target" class="rp-link">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>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules: [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test: /\.js$/,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        exclude: /[\\/]node_modules[\\/]/,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        loader: &quot;builtin:swc-loader&quot;,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        options: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          jsc: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            parser: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              syntax: &quot;ecmascript&quot;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+         env: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+           targets: &quot;Chrome &gt;= 48&quot;</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+         }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="remove-extended-resolve-extensions"><a href="#remove-extended-resolve-extensions" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove extended resolve extensions</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&#x27;s behavior.</p>
<p>In order to get the same behavior, change <code>resolve.extensions</code> to this:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  resolve</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    extensions</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-string-expression)">&#x27;...&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-string-expression)"> &#x27;.tsx&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-string-expression)"> &#x27;.ts&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-string-expression)"> &#x27;.jsx&#x27;</span><span style="color:var(--shiki-foreground)">]</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-comment)"> // &quot;...&quot; means to extend from the default extensions</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="make-swchelpers-and-react-refresh-as-peerdependencies"><a href="#make-swchelpers-and-react-refresh-as-peerdependencies" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Make @swc/helpers and react-refresh as peerDependencies</h3>
<p>Before we remove default transformation, it&#x27;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 class="rp-toc-include" id="remove-deprecated-builtins-options"><a href="#remove-deprecated-builtins-options" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove deprecated builtins options</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" class="rp-link">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" class="rp-link">here</a>.</p>
<h3 class="rp-toc-include" id="remove-builtinsass-loader"><a href="#remove-builtinsass-loader" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove builtin:sass-loader</h3>
<p><code>builtin:sass-loader</code> has been deprecated since v0.4.0. It&#x27;s removed in v0.5.0. If you are still using it, migrate to <code>sass-loader</code>.</p>
<h3 class="rp-toc-include" id="remove-experimentsincrementalrebuild-options"><a href="#remove-experimentsincrementalrebuild-options" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove experiments.incrementalRebuild options</h3>
<p><code>experiments.incrementalRebuild</code> options has been deprecated since v0.4.0. It&#x27;s removed in v0.5.0.</p>
<h3 class="rp-toc-include" id="remove-builtinsdevfriendlysplitchunks-and-experimentsnewsplitchunks"><a href="#remove-builtinsdevfriendlysplitchunks-and-experimentsnewsplitchunks" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove builtins.devFriendlySplitChunks and experiments.newSplitChunks</h3>
<p><code>experiments.newSplitChunks</code> and <code>builtins.devFriendlySplitChunks</code> has been deprecated since v0.4.0. It&#x27;s removed in v0.5.0.</p>
<h3 class="rp-toc-include" id="remove-experimentsrspackfuturenewresolver-options"><a href="#remove-experimentsrspackfuturenewresolver-options" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Remove experiments.rspackFuture.newResolver options</h3>
<p><code>experiments.rspackFuture.newResolver</code> has been deprecated since v0.4.0. It&#x27;s removed in v0.5.0.</p>
<h3 class="rp-toc-include" id="deprecating-apply-entry-lazily"><a href="#deprecating-apply-entry-lazily" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Deprecating apply entry lazily</h3>
<p>Apply entry lazily is deprecating by rspackFuture: <a href="/config/experiments#experimentsrspackfuturedisableapplyentrylazily" class="rp-link">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&#x27;t, and it&#x27;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 class="rp-toc-include" id="migration-guide"><a href="#migration-guide" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Migration guide</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&#x27;t, checkout the <a href="https://rspack.rs/blog/announcing-0.4#migration-guide" target="_blank" rel="noopener noreferrer" class="rp-link">v0.4.0 migration guide</a>.</p>
<h3 class="rp-toc-include" id="add-resolveextensions"><a href="#add-resolveextensions" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Add resolve.extensions</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&#x27;t resolve &#x27;./src/foo.tsx&#x27;</code>, or <code>Can&#x27;t resolve &#x27;./src/foo.ts&#x27;</code>, or <code>Can&#x27;t resolve &#x27;./src/foo.jsx&#x27;</code>, you need to add <code>resolve.extensions = [&#x27;...&#x27;, &#x27;.tsx&#x27;, &#x27;.ts&#x27;, &#x27;.jsx&#x27;]</code> in your configuration.</p>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff"><code><span class="line"><span style="color:var(--shiki-foreground)">const configuration = {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  resolve: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+   extensions: [&#x27;...&#x27;, &#x27;.tsx&#x27;, &#x27;.ts&#x27;, &#x27;.jsx&#x27;],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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>&#x27;.jsx&#x27;</code> to resolve.extensions. <code>&#x27;.js&#x27;</code> is one of the default extensions and all default extensions (<code>[&#x27;.js&#x27;, &#x27;.json&#x27;, &#x27;.wasm&#x27;]</code>) are represented by <code>&#x27;...&#x27;</code>.</p>
<h3 class="rp-toc-include" id="install-swchelpers-or-react-refresh"><a href="#install-swchelpers-or-react-refresh" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Install @swc/helpers or react-refresh</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>
<div class="rp-tabs"><div class="rp-tabs__label rp-tabs__label--no-scrollbar" style="justify-content:flex-start"><div class="rp-tabs__label__item rp-tabs__label__item--selected" data-index="0"><div style="display:flex;align-items:center;font-size:15px"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256"><path fill="#C12127" d="M0 256V0h256v256z"></path><path fill="#FFF" d="M48 48h160v160h-32V80h-48v128H48z"></path></svg><span style="margin-left:6px;margin-bottom:2px">npm</span></div></div><div class="rp-tabs__label__item rp-tabs__label__item--not-selected" data-index="1"><div style="display:flex;align-items:center;font-size:15px"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 128 128"><g fill="#2c8ebb"><path d="M99.24 80.71C94.9 80.76 91.1 83 87.89 85c-6 3.71-9 3.47-9 3.47l-.1-.17c-.41-.67 1.92-6.68-.69-13.84c-2.82-7.83-7.3-9.72-6.94-10.32c1.53-2.59 5.36-6.7 6.89-14.36c.91-4.64.67-12.28-1.39-16.28c-.38-.74-3.78 1.24-3.78 1.24s-3.18-7.09-4.07-7.66c-2.87-1.84-6 7.61-6 7.61a14 14 0 0 0-11.71 4.5a9.64 9.64 0 0 1-3.85 2.27c-.41.14-.91.12-2.15 3.47c-1.9 5.07 3.24 10.81 3.24 10.81s-6.13 4.33-8.4 9.72a24.78 24.78 0 0 0-1.75 11.68s-4.36 3.78-4.64 7.68a12.87 12.87 0 0 0 1.77 7.83a1.94 1.94 0 0 0 2.63.91s-2.9 3.38-.19 4.81c2.47 1.29 6.63 2 8.83-.19c1.6-1.6 1.92-5.17 2.51-6.63c.14-.34.62.57 1.08 1a10 10 0 0 0 1.36 1s-3.9 1.68-2.3 5.51c.53 1.27 2.42 2.08 5.51 2.06c1.15 0 13.76-.72 17.12-1.53a4.33 4.33 0 0 0 2.61-1.46a63 63 0 0 0 15.49-7c4.74-3.09 6.68-3.93 10.51-4.84c3.16-.75 2.95-5.65-1.24-5.58z"></path><path d="M64 2a62 62 0 1 0 62 62A62 62 0 0 0 64 2zm37.3 87.83c-3.35.81-4.91 1.44-9.41 4.36a67 67 0 0 1-15.56 7.18a8.71 8.71 0 0 1-3.64 1.77c-3.81.93-16.88 1.63-17.91 1.63h-.24c-4 0-6.27-1.24-7.49-2.54c-3.4 1.7-7.8 1-11-.69a5.55 5.55 0 0 1-3-3.9a6 6 0 0 1 0-2.06a6.66 6.66 0 0 1-.79-1A16.38 16.38 0 0 1 30 84.52c.29-3.73 2.87-7.06 4.55-8.83A28.56 28.56 0 0 1 36.61 64a26.82 26.82 0 0 1 6.82-9c-1.65-2.78-3.33-7.06-1.7-11.42c1.17-3.11 2.13-4.84 4.24-5.58a6.84 6.84 0 0 0 2.51-1.34A17.65 17.65 0 0 1 60.34 31c.19-.48.41-1 .65-1.46c1.6-3.4 3.3-5.31 5.29-6a4.88 4.88 0 0 1 4.4.5c.65.43 1.48 1 3.9 6a4.69 4.69 0 0 1 2.85-.1a3.81 3.81 0 0 1 2.39 1.94c2.47 4.74 2.8 13.19 1.72 18.62a33.8 33.8 0 0 1-5.84 13.31a25.73 25.73 0 0 1 5.77 9.43a25.42 25.42 0 0 1 1.41 10.41A28.7 28.7 0 0 0 86 81.91c3.06-1.89 7.68-4.74 13.19-4.81a6.62 6.62 0 0 1 7 5.7a6.35 6.35 0 0 1-4.89 7.03z"></path></g></svg><span style="margin-left:6px;margin-bottom:2px">yarn</span></div></div><div class="rp-tabs__label__item rp-tabs__label__item--not-selected" data-index="2"><div style="display:flex;align-items:center;font-size:15px"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 128 128"><path fill="#f8ab00" d="M0 .004V40h39.996V.004Zm43.996 0V40h40V.004Zm44.008 0V40H128V.004Zm0 43.996v39.996H128V44Z"></path><path fill="#4c4c4c" d="M43.996 44v39.996h40V44ZM0 87.996v40h39.996v-40Zm43.996 0v40h40v-40Zm44.008 0v40H128v-40Z"></path></svg><span style="margin-left:6px;margin-bottom:2px">pnpm</span></div></div><div class="rp-tabs__label__item rp-tabs__label__item--not-selected" data-index="3"><div style="display:flex;align-items:center;font-size:15px"><svg id="Bun" width="1.2em" height="1.2em" viewBox="0 0 80 70"><path id="Shadow" d="M71.09,20.74c-.16-.17-.33-.34-.5-.5s-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5A26.46,26.46,0,0,1,75.5,35.7c0,16.57-16.82,30.05-37.5,30.05-11.58,0-21.94-4.23-28.83-10.86l.5.5.5.5.5.5.5.5.5.5.5.5.5.5C19.55,65.3,30.14,69.75,42,69.75c20.68,0,37.5-13.48,37.5-30C79.5,32.69,76.46,26,71.09,20.74Z"></path><g id="Body"><path id="Background" d="M73,35.7c0,15.21-15.67,27.54-35,27.54S3,50.91,3,35.7C3,26.27,9,17.94,18.22,13S33.18,3,38,3s8.94,4.13,19.78,10C67,17.94,73,26.27,73,35.7Z" style="fill:#fbf0df"></path><path id="Bottom_Shadow" data-name="Bottom Shadow" d="M73,35.7a21.67,21.67,0,0,0-.8-5.78c-2.73,33.3-43.35,34.9-59.32,24.94A40,40,0,0,0,38,63.24C57.3,63.24,73,50.89,73,35.7Z" style="fill:#f6dece"></path><path id="Light_Shine" data-name="Light Shine" d="M24.53,11.17C29,8.49,34.94,3.46,40.78,3.45A9.29,9.29,0,0,0,38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7c0,.4,0,.8,0,1.19C9.06,15.48,20.07,13.85,24.53,11.17Z" style="fill:#fffefc"></path><path id="Top" d="M35.12,5.53A16.41,16.41,0,0,1,29.49,18c-.28.25-.06.73.3.59,3.37-1.31,7.92-5.23,6-13.14C35.71,5,35.12,5.12,35.12,5.53Zm2.27,0A16.24,16.24,0,0,1,39,19c-.12.35.31.65.55.36C41.74,16.56,43.65,11,37.93,5,37.64,4.74,37.19,5.14,37.39,5.49Zm2.76-.17A16.42,16.42,0,0,1,47,17.12a.33.33,0,0,0,.65.11c.92-3.49.4-9.44-7.17-12.53C40.08,4.54,39.82,5.08,40.15,5.32ZM21.69,15.76a16.94,16.94,0,0,0,10.47-9c.18-.36.75-.22.66.18-1.73,8-7.52,9.67-11.12,9.45C21.32,16.4,21.33,15.87,21.69,15.76Z" style="fill:#ccbea7;fill-rule:evenodd"></path><path id="Outline" d="M38,65.75C17.32,65.75.5,52.27.5,35.7c0-10,6.18-19.33,16.53-24.92,3-1.6,5.57-3.21,7.86-4.62,1.26-.78,2.45-1.51,3.6-2.19C32,1.89,35,.5,38,.5s5.62,1.2,8.9,3.14c1,.57,2,1.19,3.07,1.87,2.49,1.54,5.3,3.28,9,5.27C69.32,16.37,75.5,25.69,75.5,35.7,75.5,52.27,58.68,65.75,38,65.75ZM38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7,3,50.89,18.7,63.25,38,63.25S73,50.89,73,35.7C73,26.62,67.31,18.13,57.78,13,54,11,51.05,9.12,48.66,7.64c-1.09-.67-2.09-1.29-3-1.84C42.63,4,40.42,3,38,3Z"></path></g><g id="Mouth"><g id="Background-2" data-name="Background"><path d="M45.05,43a8.93,8.93,0,0,1-2.92,4.71,6.81,6.81,0,0,1-4,1.88A6.84,6.84,0,0,1,34,47.71,8.93,8.93,0,0,1,31.12,43a.72.72,0,0,1,.8-.81H44.26A.72.72,0,0,1,45.05,43Z" style="fill:#b71422"></path></g><g id="Tongue"><path id="Background-3" data-name="Background" d="M34,47.79a6.91,6.91,0,0,0,4.12,1.9,6.91,6.91,0,0,0,4.11-1.9,10.63,10.63,0,0,0,1-1.07,6.83,6.83,0,0,0-4.9-2.31,6.15,6.15,0,0,0-5,2.78C33.56,47.4,33.76,47.6,34,47.79Z" style="fill:#ff6164"></path><path id="Outline-2" data-name="Outline" d="M34.16,47a5.36,5.36,0,0,1,4.19-2.08,6,6,0,0,1,4,1.69c.23-.25.45-.51.66-.77a7,7,0,0,0-4.71-1.93,6.36,6.36,0,0,0-4.89,2.36A9.53,9.53,0,0,0,34.16,47Z"></path></g><path id="Outline-3" data-name="Outline" d="M38.09,50.19a7.42,7.42,0,0,1-4.45-2,9.52,9.52,0,0,1-3.11-5.05,1.2,1.2,0,0,1,.26-1,1.41,1.41,0,0,1,1.13-.51H44.26a1.44,1.44,0,0,1,1.13.51,1.19,1.19,0,0,1,.25,1h0a9.52,9.52,0,0,1-3.11,5.05A7.42,7.42,0,0,1,38.09,50.19Zm-6.17-7.4c-.16,0-.2.07-.21.09a8.29,8.29,0,0,0,2.73,4.37A6.23,6.23,0,0,0,38.09,49a6.28,6.28,0,0,0,3.65-1.73,8.3,8.3,0,0,0,2.72-4.37.21.21,0,0,0-.2-.09Z"></path></g><g id="Face"><ellipse id="Right_Blush" data-name="Right Blush" cx="53.22" cy="40.18" rx="5.85" ry="3.44" style="fill:#febbd0"></ellipse><ellipse id="Left_Bluch" data-name="Left Bluch" cx="22.95" cy="40.18" rx="5.85" ry="3.44" style="fill:#febbd0"></ellipse><path id="Eyes" d="M25.7,38.8a5.51,5.51,0,1,0-5.5-5.51A5.51,5.51,0,0,0,25.7,38.8Zm24.77,0A5.51,5.51,0,1,0,45,33.29,5.5,5.5,0,0,0,50.47,38.8Z" style="fill-rule:evenodd"></path><path id="Iris" d="M24,33.64a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,24,33.64Zm24.77,0a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,48.75,33.64Z" style="fill:#fff;fill-rule:evenodd"></path></g></svg><span style="margin-left:6px;margin-bottom:2px">bun</span></div></div><div class="rp-tabs__label__item rp-tabs__label__item--not-selected" data-index="4"><div style="display:flex;align-items:center;font-size:15px"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M1.105 18.02A11.9 11.9 0 0 1 0 12.985q0-.698.078-1.376a12 12 0 0 1 .231-1.34A12 12 0 0 1 4.025 4.02a12 12 0 0 1 5.46-2.771a12 12 0 0 1 3.428-.23c1.452.112 2.825.477 4.077 1.05a12 12 0 0 1 2.78 1.774a12.02 12.02 0 0 1 4.053 7.078A12 12 0 0 1 24 12.985q0 .454-.036.914a12 12 0 0 1-.728 3.305a12 12 0 0 1-2.38 3.875c-1.33 1.357-3.02 1.962-4.43 1.936a4.4 4.4 0 0 1-2.724-1.024c-.99-.853-1.391-1.83-1.53-2.919a5 5 0 0 1 .128-1.518c.105-.38.37-1.116.76-1.437c-.455-.197-1.04-.624-1.226-.829c-.045-.05-.04-.13 0-.183a.155.155 0 0 1 .177-.053c.392.134.869.267 1.372.35c.66.111 1.484.25 2.317.292c2.03.1 4.153-.813 4.812-2.627s.403-3.609-1.96-4.685s-3.454-2.356-5.363-3.128c-1.247-.505-2.636-.205-4.06.582c-3.838 2.121-7.277 8.822-5.69 15.032a.191.191 0 0 1-.315.19a12 12 0 0 1-1.25-1.634a12 12 0 0 1-.769-1.404M11.57 6.087c.649-.051 1.214.501 1.31 1.236c.13.979-.228 1.99-1.41 2.013c-1.01.02-1.315-.997-1.248-1.614c.066-.616.574-1.575 1.35-1.635"></path></svg><span style="margin-left:6px;margin-bottom:2px">deno</span></div></div></div><div class="rp-tabs__content"><div class="rp-tabs__content__item rp-tabs__content__item--active" aria-hidden="false" data-index="0"><div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" data-lang="bash"><code style="white-space:pre"><span class="line"><span style="color:var(--shiki-token-function)">npm</span><span style="color:var(--shiki-token-string)"> install @swc/helpers</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div></div><div class="rp-tabs__content__item rp-tabs__content__item--hidden" aria-hidden="true" data-index="1"><div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" data-lang="bash"><code style="white-space:pre"><span class="line"><span style="color:var(--shiki-token-function)">yarn</span><span style="color:var(--shiki-token-string)"> add @swc/helpers</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div></div><div class="rp-tabs__content__item rp-tabs__content__item--hidden" aria-hidden="true" data-index="2"><div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" data-lang="bash"><code style="white-space:pre"><span class="line"><span style="color:var(--shiki-token-function)">pnpm</span><span style="color:var(--shiki-token-string)"> add @swc/helpers</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div></div><div class="rp-tabs__content__item rp-tabs__content__item--hidden" aria-hidden="true" data-index="3"><div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" data-lang="bash"><code style="white-space:pre"><span class="line"><span style="color:var(--shiki-token-function)">bun</span><span style="color:var(--shiki-token-string)"> add @swc/helpers</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div></div><div class="rp-tabs__content__item rp-tabs__content__item--hidden" aria-hidden="true" data-index="4"><div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" data-lang="bash"><code style="white-space:pre"><span class="line"><span style="color:var(--shiki-token-function)">deno</span><span style="color:var(--shiki-token-string)"> add npm:@swc/helpers</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div></div></div></div>
<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>
<div class="rp-tabs"><div class="rp-tabs__label rp-tabs__label--no-scrollbar" style="justify-content:flex-start"><div class="rp-tabs__label__item rp-tabs__label__item--selected" data-index="0"><div style="display:flex;align-items:center;font-size:15px"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 256 256"><path fill="#C12127" d="M0 256V0h256v256z"></path><path fill="#FFF" d="M48 48h160v160h-32V80h-48v128H48z"></path></svg><span style="margin-left:6px;margin-bottom:2px">npm</span></div></div><div class="rp-tabs__label__item rp-tabs__label__item--not-selected" data-index="1"><div style="display:flex;align-items:center;font-size:15px"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 128 128"><g fill="#2c8ebb"><path d="M99.24 80.71C94.9 80.76 91.1 83 87.89 85c-6 3.71-9 3.47-9 3.47l-.1-.17c-.41-.67 1.92-6.68-.69-13.84c-2.82-7.83-7.3-9.72-6.94-10.32c1.53-2.59 5.36-6.7 6.89-14.36c.91-4.64.67-12.28-1.39-16.28c-.38-.74-3.78 1.24-3.78 1.24s-3.18-7.09-4.07-7.66c-2.87-1.84-6 7.61-6 7.61a14 14 0 0 0-11.71 4.5a9.64 9.64 0 0 1-3.85 2.27c-.41.14-.91.12-2.15 3.47c-1.9 5.07 3.24 10.81 3.24 10.81s-6.13 4.33-8.4 9.72a24.78 24.78 0 0 0-1.75 11.68s-4.36 3.78-4.64 7.68a12.87 12.87 0 0 0 1.77 7.83a1.94 1.94 0 0 0 2.63.91s-2.9 3.38-.19 4.81c2.47 1.29 6.63 2 8.83-.19c1.6-1.6 1.92-5.17 2.51-6.63c.14-.34.62.57 1.08 1a10 10 0 0 0 1.36 1s-3.9 1.68-2.3 5.51c.53 1.27 2.42 2.08 5.51 2.06c1.15 0 13.76-.72 17.12-1.53a4.33 4.33 0 0 0 2.61-1.46a63 63 0 0 0 15.49-7c4.74-3.09 6.68-3.93 10.51-4.84c3.16-.75 2.95-5.65-1.24-5.58z"></path><path d="M64 2a62 62 0 1 0 62 62A62 62 0 0 0 64 2zm37.3 87.83c-3.35.81-4.91 1.44-9.41 4.36a67 67 0 0 1-15.56 7.18a8.71 8.71 0 0 1-3.64 1.77c-3.81.93-16.88 1.63-17.91 1.63h-.24c-4 0-6.27-1.24-7.49-2.54c-3.4 1.7-7.8 1-11-.69a5.55 5.55 0 0 1-3-3.9a6 6 0 0 1 0-2.06a6.66 6.66 0 0 1-.79-1A16.38 16.38 0 0 1 30 84.52c.29-3.73 2.87-7.06 4.55-8.83A28.56 28.56 0 0 1 36.61 64a26.82 26.82 0 0 1 6.82-9c-1.65-2.78-3.33-7.06-1.7-11.42c1.17-3.11 2.13-4.84 4.24-5.58a6.84 6.84 0 0 0 2.51-1.34A17.65 17.65 0 0 1 60.34 31c.19-.48.41-1 .65-1.46c1.6-3.4 3.3-5.31 5.29-6a4.88 4.88 0 0 1 4.4.5c.65.43 1.48 1 3.9 6a4.69 4.69 0 0 1 2.85-.1a3.81 3.81 0 0 1 2.39 1.94c2.47 4.74 2.8 13.19 1.72 18.62a33.8 33.8 0 0 1-5.84 13.31a25.73 25.73 0 0 1 5.77 9.43a25.42 25.42 0 0 1 1.41 10.41A28.7 28.7 0 0 0 86 81.91c3.06-1.89 7.68-4.74 13.19-4.81a6.62 6.62 0 0 1 7 5.7a6.35 6.35 0 0 1-4.89 7.03z"></path></g></svg><span style="margin-left:6px;margin-bottom:2px">yarn</span></div></div><div class="rp-tabs__label__item rp-tabs__label__item--not-selected" data-index="2"><div style="display:flex;align-items:center;font-size:15px"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 128 128"><path fill="#f8ab00" d="M0 .004V40h39.996V.004Zm43.996 0V40h40V.004Zm44.008 0V40H128V.004Zm0 43.996v39.996H128V44Z"></path><path fill="#4c4c4c" d="M43.996 44v39.996h40V44ZM0 87.996v40h39.996v-40Zm43.996 0v40h40v-40Zm44.008 0v40H128v-40Z"></path></svg><span style="margin-left:6px;margin-bottom:2px">pnpm</span></div></div><div class="rp-tabs__label__item rp-tabs__label__item--not-selected" data-index="3"><div style="display:flex;align-items:center;font-size:15px"><svg id="Bun" width="1.2em" height="1.2em" viewBox="0 0 80 70"><path id="Shadow" d="M71.09,20.74c-.16-.17-.33-.34-.5-.5s-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5-.33-.34-.5-.5A26.46,26.46,0,0,1,75.5,35.7c0,16.57-16.82,30.05-37.5,30.05-11.58,0-21.94-4.23-28.83-10.86l.5.5.5.5.5.5.5.5.5.5.5.5.5.5C19.55,65.3,30.14,69.75,42,69.75c20.68,0,37.5-13.48,37.5-30C79.5,32.69,76.46,26,71.09,20.74Z"></path><g id="Body"><path id="Background" d="M73,35.7c0,15.21-15.67,27.54-35,27.54S3,50.91,3,35.7C3,26.27,9,17.94,18.22,13S33.18,3,38,3s8.94,4.13,19.78,10C67,17.94,73,26.27,73,35.7Z" style="fill:#fbf0df"></path><path id="Bottom_Shadow" data-name="Bottom Shadow" d="M73,35.7a21.67,21.67,0,0,0-.8-5.78c-2.73,33.3-43.35,34.9-59.32,24.94A40,40,0,0,0,38,63.24C57.3,63.24,73,50.89,73,35.7Z" style="fill:#f6dece"></path><path id="Light_Shine" data-name="Light Shine" d="M24.53,11.17C29,8.49,34.94,3.46,40.78,3.45A9.29,9.29,0,0,0,38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7c0,.4,0,.8,0,1.19C9.06,15.48,20.07,13.85,24.53,11.17Z" style="fill:#fffefc"></path><path id="Top" d="M35.12,5.53A16.41,16.41,0,0,1,29.49,18c-.28.25-.06.73.3.59,3.37-1.31,7.92-5.23,6-13.14C35.71,5,35.12,5.12,35.12,5.53Zm2.27,0A16.24,16.24,0,0,1,39,19c-.12.35.31.65.55.36C41.74,16.56,43.65,11,37.93,5,37.64,4.74,37.19,5.14,37.39,5.49Zm2.76-.17A16.42,16.42,0,0,1,47,17.12a.33.33,0,0,0,.65.11c.92-3.49.4-9.44-7.17-12.53C40.08,4.54,39.82,5.08,40.15,5.32ZM21.69,15.76a16.94,16.94,0,0,0,10.47-9c.18-.36.75-.22.66.18-1.73,8-7.52,9.67-11.12,9.45C21.32,16.4,21.33,15.87,21.69,15.76Z" style="fill:#ccbea7;fill-rule:evenodd"></path><path id="Outline" d="M38,65.75C17.32,65.75.5,52.27.5,35.7c0-10,6.18-19.33,16.53-24.92,3-1.6,5.57-3.21,7.86-4.62,1.26-.78,2.45-1.51,3.6-2.19C32,1.89,35,.5,38,.5s5.62,1.2,8.9,3.14c1,.57,2,1.19,3.07,1.87,2.49,1.54,5.3,3.28,9,5.27C69.32,16.37,75.5,25.69,75.5,35.7,75.5,52.27,58.68,65.75,38,65.75ZM38,3c-2.42,0-5,1.25-8.25,3.13-1.13.66-2.3,1.39-3.54,2.15-2.33,1.44-5,3.07-8,4.7C8.69,18.13,3,26.62,3,35.7,3,50.89,18.7,63.25,38,63.25S73,50.89,73,35.7C73,26.62,67.31,18.13,57.78,13,54,11,51.05,9.12,48.66,7.64c-1.09-.67-2.09-1.29-3-1.84C42.63,4,40.42,3,38,3Z"></path></g><g id="Mouth"><g id="Background-2" data-name="Background"><path d="M45.05,43a8.93,8.93,0,0,1-2.92,4.71,6.81,6.81,0,0,1-4,1.88A6.84,6.84,0,0,1,34,47.71,8.93,8.93,0,0,1,31.12,43a.72.72,0,0,1,.8-.81H44.26A.72.72,0,0,1,45.05,43Z" style="fill:#b71422"></path></g><g id="Tongue"><path id="Background-3" data-name="Background" d="M34,47.79a6.91,6.91,0,0,0,4.12,1.9,6.91,6.91,0,0,0,4.11-1.9,10.63,10.63,0,0,0,1-1.07,6.83,6.83,0,0,0-4.9-2.31,6.15,6.15,0,0,0-5,2.78C33.56,47.4,33.76,47.6,34,47.79Z" style="fill:#ff6164"></path><path id="Outline-2" data-name="Outline" d="M34.16,47a5.36,5.36,0,0,1,4.19-2.08,6,6,0,0,1,4,1.69c.23-.25.45-.51.66-.77a7,7,0,0,0-4.71-1.93,6.36,6.36,0,0,0-4.89,2.36A9.53,9.53,0,0,0,34.16,47Z"></path></g><path id="Outline-3" data-name="Outline" d="M38.09,50.19a7.42,7.42,0,0,1-4.45-2,9.52,9.52,0,0,1-3.11-5.05,1.2,1.2,0,0,1,.26-1,1.41,1.41,0,0,1,1.13-.51H44.26a1.44,1.44,0,0,1,1.13.51,1.19,1.19,0,0,1,.25,1h0a9.52,9.52,0,0,1-3.11,5.05A7.42,7.42,0,0,1,38.09,50.19Zm-6.17-7.4c-.16,0-.2.07-.21.09a8.29,8.29,0,0,0,2.73,4.37A6.23,6.23,0,0,0,38.09,49a6.28,6.28,0,0,0,3.65-1.73,8.3,8.3,0,0,0,2.72-4.37.21.21,0,0,0-.2-.09Z"></path></g><g id="Face"><ellipse id="Right_Blush" data-name="Right Blush" cx="53.22" cy="40.18" rx="5.85" ry="3.44" style="fill:#febbd0"></ellipse><ellipse id="Left_Bluch" data-name="Left Bluch" cx="22.95" cy="40.18" rx="5.85" ry="3.44" style="fill:#febbd0"></ellipse><path id="Eyes" d="M25.7,38.8a5.51,5.51,0,1,0-5.5-5.51A5.51,5.51,0,0,0,25.7,38.8Zm24.77,0A5.51,5.51,0,1,0,45,33.29,5.5,5.5,0,0,0,50.47,38.8Z" style="fill-rule:evenodd"></path><path id="Iris" d="M24,33.64a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,24,33.64Zm24.77,0a2.07,2.07,0,1,0-2.06-2.07A2.07,2.07,0,0,0,48.75,33.64Z" style="fill:#fff;fill-rule:evenodd"></path></g></svg><span style="margin-left:6px;margin-bottom:2px">bun</span></div></div><div class="rp-tabs__label__item rp-tabs__label__item--not-selected" data-index="4"><div style="display:flex;align-items:center;font-size:15px"><svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M1.105 18.02A11.9 11.9 0 0 1 0 12.985q0-.698.078-1.376a12 12 0 0 1 .231-1.34A12 12 0 0 1 4.025 4.02a12 12 0 0 1 5.46-2.771a12 12 0 0 1 3.428-.23c1.452.112 2.825.477 4.077 1.05a12 12 0 0 1 2.78 1.774a12.02 12.02 0 0 1 4.053 7.078A12 12 0 0 1 24 12.985q0 .454-.036.914a12 12 0 0 1-.728 3.305a12 12 0 0 1-2.38 3.875c-1.33 1.357-3.02 1.962-4.43 1.936a4.4 4.4 0 0 1-2.724-1.024c-.99-.853-1.391-1.83-1.53-2.919a5 5 0 0 1 .128-1.518c.105-.38.37-1.116.76-1.437c-.455-.197-1.04-.624-1.226-.829c-.045-.05-.04-.13 0-.183a.155.155 0 0 1 .177-.053c.392.134.869.267 1.372.35c.66.111 1.484.25 2.317.292c2.03.1 4.153-.813 4.812-2.627s.403-3.609-1.96-4.685s-3.454-2.356-5.363-3.128c-1.247-.505-2.636-.205-4.06.582c-3.838 2.121-7.277 8.822-5.69 15.032a.191.191 0 0 1-.315.19a12 12 0 0 1-1.25-1.634a12 12 0 0 1-.769-1.404M11.57 6.087c.649-.051 1.214.501 1.31 1.236c.13.979-.228 1.99-1.41 2.013c-1.01.02-1.315-.997-1.248-1.614c.066-.616.574-1.575 1.35-1.635"></path></svg><span style="margin-left:6px;margin-bottom:2px">deno</span></div></div></div><div class="rp-tabs__content"><div class="rp-tabs__content__item rp-tabs__content__item--active" aria-hidden="false" data-index="0"><div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" data-lang="bash"><code style="white-space:pre"><span class="line"><span style="color:var(--shiki-token-function)">npm</span><span style="color:var(--shiki-token-string)"> install react-refresh</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div></div><div class="rp-tabs__content__item rp-tabs__content__item--hidden" aria-hidden="true" data-index="1"><div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" data-lang="bash"><code style="white-space:pre"><span class="line"><span style="color:var(--shiki-token-function)">yarn</span><span style="color:var(--shiki-token-string)"> add react-refresh</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div></div><div class="rp-tabs__content__item rp-tabs__content__item--hidden" aria-hidden="true" data-index="2"><div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" data-lang="bash"><code style="white-space:pre"><span class="line"><span style="color:var(--shiki-token-function)">pnpm</span><span style="color:var(--shiki-token-string)"> add react-refresh</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div></div><div class="rp-tabs__content__item rp-tabs__content__item--hidden" aria-hidden="true" data-index="3"><div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" data-lang="bash"><code style="white-space:pre"><span class="line"><span style="color:var(--shiki-token-function)">bun</span><span style="color:var(--shiki-token-string)"> add react-refresh</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div></div><div class="rp-tabs__content__item rp-tabs__content__item--hidden" aria-hidden="true" data-index="4"><div class="rp-codeblock language-bash"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" data-lang="bash"><code style="white-space:pre"><span class="line"><span style="color:var(--shiki-token-function)">deno</span><span style="color:var(--shiki-token-string)"> add npm:react-refresh</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div></div></div></div>
<h3 class="rp-toc-include" id="apply-rspackhotmodulereplacementplugin"><a href="#apply-rspackhotmodulereplacementplugin" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Apply rspack.HotModuleReplacementPlugin</h3>
<p>If you are using <code>@rspack/cli</code>, or rsbuild, or other higher-level framework of Rspack to develop applications, you don&#x27;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>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff"><code><span class="line"><span style="color:var(--shiki-foreground)">class CustomDevServer {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  enableHMR(compiler) {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-   compiler.options.devServer ??= {};</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-   compiler.options.devServer.hot = true;</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+   new compiler.rspack.HotModuleReplacementPlugin().apply(compiler);</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="do-not-change-entry-options-after-rspackoptions"><a href="#do-not-change-entry-options-after-rspackoptions" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Do not change entry options after rspack(options)</h3>
<p>If you are using <code>@rspack/cli</code>, or rsbuild, or other higher-level framework of Rspack to develop applications, you don&#x27;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>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff"><code><span class="line"><span style="color:var(--shiki-foreground)">const { rspack } = require(&#x27;@rspack/core&#x27;);</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">const compiler = rspack(options);</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-foreground)">function prependEntry(compiler, additionalEntry) {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-  for (const key in compiler.options.entry) {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-    compiler.options.entry[key].import = [</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-      additionalEntry,</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-      ...(compiler.options.entry[key].import || []),</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-    ];</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-  }</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+  new compiler.rspack.EntryPlugin(compiler.context, additionalEntry, {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    name: undefined, // `name: undefined` to prepend the it to every entry, or add it to a specified entry with specified entry name</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+  }).apply(compiler);</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-foreground)">prependEntry(compiler, &#x27;dev-client.js&#x27;);</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div><!--/$-->]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Module Federation added to Rspack]]></title>
            <link>https://rspack.rs/blog/module-federation-added-to-rspack</link>
            <guid isPermaLink="false">/blog/module-federation-added-to-rspack</guid>
            <pubDate>Tue, 09 Jan 2024 13:21:00 GMT</pubDate>
            <description><![CDATA[The latest Rspack 0.5.0 introduces the highly anticipated Module Federation, which is detailed in this article.]]></description>
            <content:encoded><![CDATA[<!--$--><h1 class="rp-toc-include" id="module-federation-added-to-rspack"><a href="#module-federation-added-to-rspack" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Module Federation added to Rspack<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<blockquote>
<p>January 09, 2024</p>
</blockquote>
<h2 class="rp-toc-include" id="introducing-rspack-050"><a href="#introducing-rspack-050" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Introducing Rspack 0.5.0</h2>
<p>The latest Rspack 0.5.0 introduces the highly anticipated Module Federation along with the new &quot;v1.5&quot; 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>
<div><img src="https://assets.rspack.rs/rspack/assets/rspack-federation-with-rspack.png" width="50%" height="50%" alt="Rspack with Infinity Gauntlet"/></div>
<h2 class="rp-toc-include" id="webpack-federation-gets-some-love"><a href="#webpack-federation-gets-some-love" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Webpack federation gets some love!</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&#x27;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" class="rp-link">@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 class="rp-toc-include" id="migration-opportunities"><a href="#migration-opportunities" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Migration opportunities</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" class="rp-link">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" class="rp-link">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" class="rp-link">@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 class="rp-toc-include" id="speed-comparison-to-webpack-federation"><a href="#speed-comparison-to-webpack-federation" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Speed comparison to webpack federation</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" class="rp-link">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 class="rp-toc-include" id="rsbuild-support"><a href="#rsbuild-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rsbuild support</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&#x27;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" class="rp-link">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" class="rp-link">here</a>. This guide is also beneficial for CRA users seeking an easy performance boost for aging builds: <a href="/guide/migration/cra" class="rp-link">Rsbuild Migration Guide</a>. Rsbuild has also been fantastic for <a href="https://rsbuild.rs/guide/migration/vue-cli" target="_blank" rel="noopener noreferrer" class="rp-link">migrating Vue examples off vue-cli</a> and onto something faster, easier, and federation friendly.</p>
<h2 class="rp-toc-include" id="the-difference-between-federation-v1-and-v15"><a href="#the-difference-between-federation-v1-and-v15" class="rp-header-anchor rp-link" aria-hidden="true">#</a>The difference between federation v1 and v1.5</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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { rspack } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { fileURLToPath } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;node:url&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.</span><span style="color:var(--shiki-token-constant)">container</span><span style="color:var(--shiki-token-function)">.ModuleFederationPlugin</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  name</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;app1&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  filename</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;static/js/remoteEntry.js&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  exposes</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">    &#x27;./Button&#x27;</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./src/components/button.js&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  runtimePlugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">    fileURLToPath</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-function)"> URL</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./my-custom-plugin.js&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-keyword)"> import</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">meta</span><span style="color:var(--shiki-foreground)">.url))</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  remotes</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    app2</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;app2@http://localhost:3002/static/js/remoteEntry.js&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  shared</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    react</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> { singleton</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-foreground)"> }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">    &#x27;react-dom&#x27;</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> { singleton</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-foreground)"> }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>And For webpack:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { ModuleFederationPlugin } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@module-federation/enhanced&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { fileURLToPath } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;node:url&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-function)"> ModuleFederationPlugin</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  name</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;app1&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  filename</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;static/js/remoteEntry.js&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  exposes</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">    &#x27;./Button&#x27;</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./src/components/button.js&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  runtimePlugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">    fileURLToPath</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-function)"> URL</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./my-custom-plugin.js&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-keyword)"> import</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">meta</span><span style="color:var(--shiki-foreground)">.url))</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  remotes</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    app2</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;app2@http://localhost:3002/static/js/remoteEntry.js&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  shared</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    react</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> { singleton</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-foreground)"> }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">    &#x27;react-dom&#x27;</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> { singleton</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-foreground)"> }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">here</a></p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-comment)">// Can load modules using only the runtime SDK without relying on build plugins</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// When not using build plugins, shared dependencies cannot be automatically reused</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { init</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> loadRemote } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@module-federation/runtime-tools&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> customPlugin </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./runtimePlugin&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-function)">init</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  name</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;app1&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  remotes</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      name</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;runtime_remote1&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      alias</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;app2&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      entry</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;http://localhost:3006/remoteEntry.js&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  shared</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    react</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      version</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;18.2.0&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      scope</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;default&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">      lib</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> () </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> React</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      shareConfig</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        singleton</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        requiredVersion</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;&gt;17&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">    &#x27;react-dom&#x27;</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      version</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;18.2.0&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      scope</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;default&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-token-function)">      lib</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> () </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> ReactDOM</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      shareConfig</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        singleton</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        requiredVersion</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;&gt;17&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span><span style="color:var(--shiki-token-function)">customPlugin</span><span style="color:var(--shiki-foreground)">()]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-comment)">// Load by alias</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">loadRemote </span><span style="color:var(--shiki-token-keyword)">&lt;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  { add</span><span style="color:var(--shiki-token-punctuation)">:</span><span style="color:var(--shiki-foreground)"> (</span><span style="color:var(--shiki-token-keyword)">...</span><span style="color:var(--shiki-foreground)">args</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-function)"> Array</span><span style="color:var(--shiki-foreground)">&lt;</span><span style="color:var(--shiki-token-constant)">number</span><span style="color:var(--shiki-foreground)">&gt;) </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> number } </span><span style="color:var(--shiki-token-keyword)">&gt;</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">  &#x27;app2/util&#x27;</span><span style="color:var(--shiki-token-function)">.then</span><span style="color:var(--shiki-foreground)">(md </span><span style="color:var(--shiki-token-keyword)">=&gt;</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-token-constant)">    md</span><span style="color:var(--shiki-token-function)">.add</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-constant)">1</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-constant)"> 2</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-constant)"> 3</span><span style="color:var(--shiki-foreground)">);</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  });</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>Read more about Federation 1.5 Update: <a href="https://github.com/module-federation/universe/discussions/1936" target="_blank" rel="noopener noreferrer" class="rp-link">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 isPermaLink="false">/blog/announcing-0-4</guid>
            <pubDate>Wed, 22 Nov 2023 17:31:00 GMT</pubDate>
            <description><![CDATA[Rspack 0.4 is out, removing support for some builtin features.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>November 02, 2023</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-04"><a href="#announcing-rspack-04" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 0.4<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<h2 class="rp-toc-include" id="major-changes"><a href="#major-changes" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Major changes</h2>
<h3 class="rp-toc-include" id="drop-nodejs-14-support"><a href="#drop-nodejs-14-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Drop Node.js 14 support</h3>
<p>Rspack no longer supports Node.js 14, Node.js 16+ is now required.</p>
<h3 class="rp-toc-include" id="make-rspackcore-as-peer-dependency-of-rspackcli"><a href="#make-rspackcore-as-peer-dependency-of-rspackcli" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Make @rspack/core as peer dependency of @rspack/cli</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" class="rp-link">Rsbuild</a> as an out-of-the-box solution.</p>
<h3 class="rp-toc-include" id="deprecating-default-transformation"><a href="#deprecating-default-transformation" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Deprecating default transformation</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" class="rp-link">builtins</a> code transformation features, <a href="/config/target" class="rp-link">target</a>, and custom <a href="/config/module-rules#rulestype" class="rp-link">rules[].type</a>.</p>
<ol>
<li>Removal of support for some <a href="https://v0.rspack.rs/config/builtins" target="_blank" rel="noopener noreferrer" class="rp-link">builtins</a> features:</li>
</ol>
<ul>
<li><a href="https://v0.rspack.rs/config/builtins#builtinsrelay" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">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" class="rp-link">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" class="rp-link">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" class="rp-link">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" class="rp-link">builtins.presetEnv</a>: moved to <code>jsc.env</code></li>
</ul>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.jsx</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        loader</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;builtin:swc-loader&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        options</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          jsc</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            parser</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              syntax</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;ecmascript&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              jsx</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            transform</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              react</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                runtime</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;automatic&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          rspackExperiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            emotion</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-comment)"> // The same as `builtins`</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        type</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;javascript/auto&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rspackFuture</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      disableTransformByDefault</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<ol start="2">
<li><a href="/config/target" class="rp-link">target</a> will not downgrade user-side code(including <code>node_modules</code>)</li>
</ol>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  target: [&quot;web&quot;, &quot;es5&quot;],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules: [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test: /\.[cm]?js$/,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        exclude: /node_modules/,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        loader: &#x27;builtin:swc-loader&#x27;,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        options: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          jsc: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            parser: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              syntax: &quot;ecmascript&quot;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+           target: &quot;es5&quot; // Notice: `jsc.target` and `env` cannot be set at the same time.</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        env: { //  Notice: `jsc.target` and `env` cannot be set at the same time.</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+         targets: &quot;chrome &gt;= 48&quot;</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+        }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        type: &#x27;javascript/auto&#x27;,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<ol start="3">
<li>Removed non-webpack compatible <a href="/config/module-rules#rulestype" class="rp-link">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" class="rp-link">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" class="rp-link">here</a>.</p>
<h3 class="rp-toc-include" id="deprecating-builtinreactrefresh"><a href="#deprecating-builtinreactrefresh" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Deprecating builtin.react.refresh</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>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-inserted)">+ import { ReactRefreshRspackPlugin } from &#x27;@rspack/plugin-react-refresh&#x27;;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-foreground)">const isDev = process.env.NODE_ENV === &#x27;development&#x27;;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  mode: isDev ? &#x27;development&#x27; : &#x27;production&#x27;,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules: [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test: /\.jsx$/,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        use: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          loader: &#x27;builtin:swc-loader&#x27;,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          options: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            jsc: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              parser: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                syntax: &#x27;ecmascript&#x27;,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                jsx: true,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              transform: {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                react: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+                  development: isDev,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+                  refresh: isDev,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  },</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-  builtins: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-    react: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-      refresh: true,</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-    }</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-  },</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins: [</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    isDev &amp;&amp; new ReactRefreshRspackPlugin()</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ],</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>Checkout <a href="/guide/tech/react#fast-refresh" class="rp-link">here</a> for more details.</p>
<h3 class="rp-toc-include" id="deprecating-builtinsass-loader"><a href="#deprecating-builtinsass-loader" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Deprecating builtin:sass-loader</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 class="rp-toc-include" id="deprecating-experimentsincrementalrebuild"><a href="#deprecating-experimentsincrementalrebuild" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Deprecating experiments.incrementalRebuild</h3>
<p><code>experiments.incrementalRebuild</code> has now been deprecated. Rspack will remove it in v0.5.0.</p>
<h3 class="rp-toc-include" id="refactoring-export-api-in-rspackcore"><a href="#refactoring-export-api-in-rspackcore" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Refactoring export API in @rspack/core</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&#x27;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 class="rp-toc-include" id="deprecating-builtinsdevfriendlysplitchunks-and-experimentsnewsplitchunks"><a href="#deprecating-builtinsdevfriendlysplitchunks-and-experimentsnewsplitchunks" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Deprecating <code>builtins.devFriendlySplitChunks</code> and <code>experiments.newSplitChunks</code></h3>
<p>In order to full migrate to Webpack&#x27;s split chunks implementation, these fields are deprecated. Rspack will remove these fields in v0.5.0.</p>
<h3 class="rp-toc-include" id="enable-newresolver-by-default"><a href="#enable-newresolver-by-default" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Enable newResolver by default</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" class="rp-link">enhanced-resolve</a>&#x27;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>&#x27;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" class="rp-link">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 class="rp-toc-include" id="migration-guide"><a href="#migration-guide" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Migration guide</h2>
<p>There is a <a href="https://github.com/rstackjs/rstack-examples/pull/2" target="_blank" rel="noopener noreferrer" class="rp-link">migrate example</a> demonstrating how to migrate from Rspack 0.3.14 to Rspack 0.4.0.</p>
<h3 class="rp-toc-include" id="choose-rspackcli-or-rsbuild"><a href="#choose-rspackcli-or-rsbuild" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Choose <code>@rspack/cli</code> or <code>Rsbuild</code>?</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 class="rp-toc-include" id="upgrade-nodejs-version"><a href="#upgrade-nodejs-version" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Upgrade Node.js version</h3>
<p>Rspack no longer supports Node.js 14 as of version 0.4.0; Node.js 16+ is now required.</p>
<h3 class="rp-toc-include" id="install-rspackcore-manually-with-rspackcli"><a href="#install-rspackcore-manually-with-rspackcli" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Install <code>@rspack/core</code> manually with <code>@rspack/cli</code></h3>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">package.json</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="package.json"><code><span class="line"><span style="color:var(--shiki-foreground)">{</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  &quot;devDependencies&quot;: {</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    &quot;@rspack/core&quot;: &quot;0.4.0&quot;,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">     &quot;@rspack/cli&quot;: &quot;0.4.0&quot;</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="use-builtinswc-loader-to-support-module-transformation"><a href="#use-builtinswc-loader-to-support-module-transformation" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Use <code>builtin:swc-loader</code> to support module transformation</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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-foreground)">{</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  experiments</span><span style="color:var(--shiki-token-punctuation)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rspackFuture</span><span style="color:var(--shiki-token-punctuation)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      disableTransformByDefault</span><span style="color:var(--shiki-token-punctuation)">:</span><span style="color:var(--shiki-token-constant)"> false</span><span style="color:var(--shiki-foreground)">; </span><span style="color:var(--shiki-token-comment)">// set to old transform behavior</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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" class="rp-link">Deprecating Default Transformation</a>.</p>
<h3 class="rp-toc-include" id="use-rspackplugin-react-refresh-for-react-applications"><a href="#use-rspackplugin-react-refresh-for-react-applications" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Use <code>@rspack/plugin-react-refresh</code> for React applications</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" class="rp-link">Deprecating builtin.react.refresh</a>.</p>
<h3 class="rp-toc-include" id="migrating-builtin-options-to-builtin-plugins"><a href="#migrating-builtin-options-to-builtin-plugins" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Migrating builtin options to builtin plugins</h3>
<p>In v0.4.0, Rspack deprecated some of the builtin options and migrated them to <a href="/config/plugins" class="rp-link">builtin plugins</a>.</p>
<p>Currently, Rspack&#x27;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>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-inserted)">+ import { rspack } from &#x27;@rspack/core&#x27;;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-  builtins: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-    define: { process.env.NODE_ENV: JSON.stringify(process.env.NODE_ENV) }</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-  },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+  plugins: [</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    new rspack.DefinePlugin({ process.env.NODE_ENV: JSON.stringify(process.env.NODE_ENV) })</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+  ]</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>For <code>builtins.html</code>, it can be directly migrated to <a href="/plugins/rspack/html-rspack-plugin" class="rp-link">HtmlRspackPlugin</a>:</p>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-inserted)">+ import { rspack } from &#x27;@rspack/core&#x27;;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-  builtins: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-    html: [{ template: &quot;./index.html&quot; }]</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-  },</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+  plugins: [</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    new rspack.HtmlRspackPlugin({ template: &quot;./index.html&quot; })</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+  ]</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>When there are multiple configurations in <code>builtins.html</code>, multiple plugin instances can be created:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { rspack } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">    new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.HtmlRspackPlugin</span><span style="color:var(--shiki-foreground)">({ template</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./index.html&#x27;</span><span style="color:var(--shiki-foreground)"> })</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">    new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.HtmlRspackPlugin</span><span style="color:var(--shiki-foreground)">({ template</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;./foo.html&#x27;</span><span style="color:var(--shiki-foreground)"> })</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>For <code>builtins.copy</code>, it can be directly migrated to <a href="/plugins/rspack/copy-rspack-plugin" class="rp-link">CopyRspackPlugin</a>.</p>
<p>For the original <code>builtins.minifyOptions</code>, we provide <a href="/plugins/rspack/swc-js-minimizer-rspack-plugin" class="rp-link">SwcJsMinimizerRspackPlugin</a>:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { rspack } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  optimization</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    minimizer</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">      new</span><span style="color:var(--shiki-token-constant)"> rspack</span><span style="color:var(--shiki-token-function)">.SwcJsMinimizerRspackPlugin</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-token-comment)">        // minimizer configuration</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      })</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>Other builtin options can be directly referred to the rspack <a href="/config/plugins" class="rp-link">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 isPermaLink="false">/blog/announcing-0-3</guid>
            <pubDate>Thu, 24 Aug 2023 12:15:00 GMT</pubDate>
            <description><![CDATA[Rspack 0.3 is out, adding support for web workers and the builtin:swc-loader.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>August 24, 2023</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-03"><a href="#announcing-rspack-03" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 0.3<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<h2 class="rp-toc-include" id="breaking-changes"><a href="#breaking-changes" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Breaking changes</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 class="rp-toc-include" id="removal-of-rspackpostcss-loader-and-builtinspostcss"><a href="#removal-of-rspackpostcss-loader-and-builtinspostcss" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Removal of @rspack/postcss-loader and builtins.postcss</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&#x27;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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  builtins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    postcss</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      pxtorem</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        rootValue</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> 50</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>• After:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.css</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        use</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            loader</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;postcss-loader&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            options</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              postcssOptions</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                  [</span></span>
<span class="line"><span style="color:var(--shiki-token-string-expression)">                    &#x27;postcss-plugin-px2rem&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                    {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                      rootValue</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> 100</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                  ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="removal-of-built-in-css-autoprefixer-functionality"><a href="#removal-of-built-in-css-autoprefixer-functionality" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Removal of built-in CSS autoprefixer functionality</h3>
<p>To align better with webpack&#x27;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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.css</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        use</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            loader</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;postcss-loader&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            options</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              postcssOptions</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                plugins</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [[</span><span style="color:var(--shiki-token-string-expression)">&#x27;autoprefixer&#x27;</span><span style="color:var(--shiki-foreground)">]]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        type</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;css&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>You can refer to the <a href="https://github.com/rstackjs/rstack-examples/tree/main/rspack/postcss-loader" target="_blank" rel="noopener noreferrer" class="rp-link">examples/postcss-loader</a> for a complete example.</p>
<h3 class="rp-toc-include" id="access-to-internal-modules-restricted"><a href="#access-to-internal-modules-restricted" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Access to internal modules restricted</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&#x27;s API from the root module.</p>
<p>• Before:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { Stats } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core/dist/stats&#x27;</span><span style="color:var(--shiki-foreground)">; </span><span style="color:var(--shiki-token-comment)">// not supported since 0.3</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>• After:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { Stats } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/core&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h2 class="rp-toc-include" id="major-feature-updates"><a href="#major-feature-updates" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Major feature updates</h2>
<h3 class="rp-toc-include" id="web-workers-support"><a href="#web-workers-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Web Workers support</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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-function)"> Worker</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-function)"> URL</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./worker.js&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-keyword)"> import</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">meta</span><span style="color:var(--shiki-foreground)">.url));</span></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-function)"> Worker</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-keyword)">new</span><span style="color:var(--shiki-token-function)"> URL</span><span style="color:var(--shiki-foreground)">(</span><span style="color:var(--shiki-token-string-expression)">&#x27;./worker.js&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-token-keyword)"> import</span><span style="color:var(--shiki-foreground)">.</span><span style="color:var(--shiki-token-constant)">meta</span><span style="color:var(--shiki-foreground)">.url)</span><span style="color:var(--shiki-token-punctuation)">,</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  name</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;my-worker&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>For more information about web workers support, see <a href="/guide/features/web-workers" class="rp-link">web workers</a>.</p>
<h3 class="rp-toc-include" id="builtinswc-loader-support"><a href="#builtinswc-loader-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a><code>builtin:swc-loader</code> support</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>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> { defineConfig } </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;@rspack/cli&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-token-function)"> defineConfig</span><span style="color:var(--shiki-foreground)">({</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        test</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> /\.jsx</span><span style="color:var(--shiki-token-keyword)">$</span><span style="color:var(--shiki-token-string-expression)">/</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        use</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          loader</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;builtin:swc-loader&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          options</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            jsc</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              parser</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                syntax</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;ecmascript&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                jsx</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              transform</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                react</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                  pragma</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;React.createElement&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                  pragmaFrag</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;React.Fragment&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                  throwIfNamespace</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> true</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                  development</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-constant)"> false</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">                }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">              }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">            }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">          }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        type</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;javascript/auto&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">});</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>You can refer to <a href="https://github.com/rstackjs/rstack-examples/tree/main/rspack/builtin-swc-loader" target="_blank" rel="noopener noreferrer" class="rp-link">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 class="rp-toc-include" id="improved-profile-support"><a href="#improved-profile-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improved profile support</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>
<div class="rp-codeblock language-sh"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="sh"><code><span class="line"><span style="color:var(--shiki-token-function)">$</span><span style="color:var(--shiki-token-string)"> RSPACK_PROFILE=ALL</span><span style="color:var(--shiki-token-string)"> rspack</span><span style="color:var(--shiki-token-string)"> build</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>For more detailed information about Profile, see <a href="/guide/optimization/profile" class="rp-link">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 class="rp-toc-include" id="more-hook-and-plugin-support"><a href="#more-hook-and-plugin-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>More hook and plugin support</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" class="rp-link">plugin-api-progress</a>.</p>
<h3 class="rp-toc-include" id="alignment-with-webpack-architecture"><a href="#alignment-with-webpack-architecture" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Alignment with webpack architecture</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 class="rp-toc-include" id="rspack-ecosystem"><a href="#rspack-ecosystem" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Rspack ecosystem</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" class="rp-link">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 isPermaLink="false">/blog/announcing-0-2</guid>
            <pubDate>Fri, 02 Jun 2023 13:11:00 GMT</pubDate>
            <description><![CDATA[Rspack 0.2 is out, introducing many new features, such as support for realContentHash, DataURI, and the ESM format, and more.]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>June 02, 2023</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-02"><a href="#announcing-rspack-02" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 0.2<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<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 class="rp-toc-include" id="main-feature-updates"><a href="#main-feature-updates" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Main feature updates</h2>
<h3 class="rp-toc-include" id="loader"><a href="#loader" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Loader</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/" class="rp-link">Loader API</a>.</p>
<h3 class="rp-toc-include" id="plugin-hooks"><a href="#plugin-hooks" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Plugin hooks</h3>
<p>New hooks for plugins have been added.</p>
<p>Compiler hooks:</p>
<ol>
<li><a href="/api/plugin-api/compiler-hooks#beforecompile" class="rp-link">beforeCompile</a></li>
<li><a href="/api/plugin-api/compiler-hooks#aftercompile" class="rp-link">afterCompile</a></li>
</ol>
<p>Compilation hooks:</p>
<ol>
<li><a href="/api/plugin-api/compilation-hooks#optimizemodules" class="rp-link">optimizeModules</a></li>
<li><a href="/api/plugin-api/compilation-hooks#optimizechunkmodules" class="rp-link">optimizeChunkModule</a></li>
<li><a href="/api/plugin-api/compilation-hooks#finishmodules" class="rp-link">finishModules</a></li>
<li><a href="/api/plugin-api/compilation-hooks#chunkasset" class="rp-link">chunkAsset</a></li>
</ol>
<p>NormalModuleFactory hooks:</p>
<ol>
<li><a href="/api/plugin-api/normal-module-factory-hooks#beforeresolve" class="rp-link">beforeResolve</a></li>
<li><a href="/api/plugin-api/normal-module-factory-hooks#afterresolve" class="rp-link">afterResolve</a></li>
<li><a href="/api/plugin-api/normal-module-factory-hooks#resolveforscheme" class="rp-link">ResolveForScheme</a></li>
</ol>
<p>ContextModuleFactory hooks:</p>
<ol>
<li><a href="/api/plugin-api/context-module-factory-hooks#beforeresolve" class="rp-link">beforeResolve</a></li>
</ol>
<h3 class="rp-toc-include" id="realcontenthash"><a href="#realcontenthash" class="rp-header-anchor rp-link" aria-hidden="true">#</a>realContentHash</h3>
<p>We have implemented optimization.realContentHash, which calculates the Hash based on the final product&#x27;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 class="rp-toc-include" id="esmsystem-format"><a href="#esmsystem-format" class="rp-header-anchor rp-link" aria-hidden="true">#</a>ESM/System format</h3>
<p>In the new version, System/ESM products can be generated, and the configuration for outputting ESM products is as follows:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  output</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    chunkFormat</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;module&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    chunkLoading</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;import&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    library</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      type</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;module&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h3 class="rp-toc-include" id="new-splitchunksplugin-implementation"><a href="#new-splitchunksplugin-implementation" class="rp-header-anchor rp-link" aria-hidden="true">#</a>New <code>SplitChunksPlugin</code> implementation</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 class="rp-toc-include" id="datauri-support"><a href="#datauri-support" class="rp-header-anchor rp-link" aria-hidden="true">#</a>DataURI support</h3>
<p>We have implemented support for DataURI. Now you can write the following code to implement virtual modules:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js"><code><span class="line"><span style="color:var(--shiki-token-keyword)">import</span><span style="color:var(--shiki-foreground)"> x </span><span style="color:var(--shiki-token-keyword)">from</span><span style="color:var(--shiki-token-string-expression)"> &#x27;data:text/javascript,export default 42&#x27;</span><span style="color:var(--shiki-foreground)">;</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<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>&#x27;data&#x27;</code> no longer treated as inline processing, but as separate resource files through the following method:</p>
<div class="rp-codeblock language-js"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="js" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-token-keyword)">export</span><span style="color:var(--shiki-token-keyword)"> default</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  module</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    rules</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-foreground)"> [</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        scheme</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;data&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">        type</span><span style="color:var(--shiki-token-keyword)">:</span><span style="color:var(--shiki-token-string-expression)"> &#x27;asset/resource&#x27;</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">      }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">    ]</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span><span style="color:var(--shiki-token-punctuation)">,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">};</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<h2 class="rp-toc-include" id="breaking-changes"><a href="#breaking-changes" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Breaking changes</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>
<div class="rp-codeblock language-diff"><div class="rp-codeblock__title">rspack.config.mjs</div><div class="rp-codeblock__content"><div class="rp-codeblock__content__scroll-container rp-scrollbar rp-scrollbar--always"><pre class="shiki css-variables" style="background-color:var(--shiki-background);color:var(--shiki-foreground)" tabindex="0" data-lang="diff" data-title="rspack.config.mjs"><code><span class="line"><span style="color:var(--shiki-foreground)">export default {</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  output: {</span></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-    filename: &quot;[name][ext]&quot;,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    filename: &quot;[name].js&quot;,</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-    chunkFilename: &quot;async/[name][ext]&quot;,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    chunkFilename: &quot;async/[name].js&quot;,</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-    cssFilename: &quot;[name][ext]&quot;,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    cssFilename: &quot;[name].css&quot;,</span></span>
<span class="line"></span>
<span class="line"><span style="color:var(--shiki-token-deleted)">-    cssChunkFilename: &quot;async/[name][ext]&quot;,</span></span>
<span class="line"><span style="color:var(--shiki-token-inserted)">+    cssChunkFilename: &quot;async/[name].css&quot;,</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">  }</span></span>
<span class="line"><span style="color:var(--shiki-foreground)">}</span></span></code></pre></div><div class="rp-code-button-group"><button class="rp-code-button-group__button rp-code-wrap-button" title="Toggle code wrap"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrapped"><path fill="currentColor" d="M21 5H3v2h18zM3 19h7v-2H3zm0-6h15c1 0 2 .43 2 2s-1 2-2 2h-2v-2l-4 3 4 3v-2h2c2.95 0 4-1.27 4-4 0-2.72-1-4-4-4H3z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-button-group__icon--wrap"><path fill="currentColor" d="M16 7H3V5h13zM3 19h13v-2H3zm19-7-4-3v2H3v2h15v2z"></path></svg></button><button class="rp-code-button-group__button rp-code-copy-button" title="Copy code"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-code-button-group__icon rp-code-copy-button__icon rp-code-copy-button__icon--success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg></button></div></div></div>
<p>Details: <a href="https://github.com/web-infra-dev/rspack/issues/3270" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">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" class="rp-link">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" class="rp-link">https://github.com/web-infra-dev/rspack/pull/3358</a></p>
</li>
</ul>
<h2 class="rp-toc-include" id="webpack-compatibility-updates"><a href="#webpack-compatibility-updates" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Webpack compatibility updates</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 class="rp-toc-include" id="fork-ts-checker-webpack-plugin"><a href="#fork-ts-checker-webpack-plugin" class="rp-header-anchor rp-link" aria-hidden="true">#</a>fork-ts-checker-webpack-plugin</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" class="rp-link">fork-ts-checker-webpack-plugin</a>. You can use this plugin to perform TypeScript type checking during compilation. However, as TypeScript&#x27;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 class="rp-toc-include" id="license-webpack-plugin"><a href="#license-webpack-plugin" class="rp-header-anchor rp-link" aria-hidden="true">#</a>license-webpack-plugin</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" class="rp-link">license-webpack-plugin</a>.</p>
<h3 class="rp-toc-include" id="style-loader--css-loader"><a href="#style-loader--css-loader" class="rp-header-anchor rp-link" aria-hidden="true">#</a>style-loader &amp; css-loader</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" class="rp-link">style-loader</a> &amp; <a href="https://github.com/webpack/css-loader" target="_blank" rel="noopener noreferrer" class="rp-link">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 class="rp-toc-include" id="node-loader"><a href="#node-loader" class="rp-header-anchor rp-link" aria-hidden="true">#</a>node-loader</h3>
<p>When using Rspack to package Node applications like NestJS, a common requirement is to package libraries containing addons. These libraries&#x27; 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" class="rp-link">node-loader</a>, so you can now use Rspack to build node applications.</p>
<p>Rspack has additional adaptation of webpack&#x27;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" class="rp-link">loader-compat</a> and <a href="https://github.com/rstackjs/rstack-examples/tree/main/rspack/plugin" target="_blank" rel="noopener noreferrer" class="rp-link">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 class="rp-toc-include" id="framework-ecosystem-updates"><a href="#framework-ecosystem-updates" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Framework ecosystem updates</h2>
<h3 class="rp-toc-include" id="modernjs-framework"><a href="#modernjs-framework" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Modern.js Framework</h3>
<p>Thanks to the close collaboration and parallel iteration of the <a href="https://modernjs.dev/en/" target="_blank" rel="noopener noreferrer" class="rp-link">Modern.js framework</a> and Rspack, <strong>Modern.js Rspack mode has covered 85% of the framework&#x27;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 class="rp-toc-include" id="modernjs-doc"><a href="#modernjs-doc" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Modern.js Doc</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" class="rp-link">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&#x27;s build speed can be reduced to seconds. Using the Modern.js official website documentation as an example, the project&#x27;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" class="rp-link">Modern.js code repository</a> and experience the above content.</p>
</blockquote>
<h3 class="rp-toc-include" id="vue"><a href="#vue" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Vue</h3>
<p>Rspack 0.2 has achieved compatibility with vue-loader! For Vue 3 projects, you can use Rspack&#x27;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" class="rp-link">guide-vue</a>.</p>
<h3 class="rp-toc-include" id="svelte"><a href="#svelte" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Svelte</h3>
<p>Thanks to Rspack&#x27;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" class="rp-link">svelte-loader</a>, Rspack has fully adapted <a href="https://github.com/sveltejs/svelte-loader" target="_blank" rel="noopener noreferrer" class="rp-link">svelte-loader</a>. Therefore, you can directly use <a href="https://github.com/sveltejs/svelte-loader" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">example-svelte</a> to complete the svelte-loader related configuration.</p>
<h3 class="rp-toc-include" id="storybook"><a href="#storybook" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Storybook</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" class="rp-link">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 class="rp-toc-include" id="angular"><a href="#angular" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Angular</h3>
<p>With the help of the <a href="https://valor-software.com/" target="_blank" rel="noopener noreferrer" class="rp-link">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 class="rp-toc-include" id="nestjs"><a href="#nestjs" class="rp-header-anchor rp-link" aria-hidden="true">#</a>NestJS</h3>
<p>With the help of <a href="https://rosa.be/" target="_blank" rel="noopener noreferrer" class="rp-link">Rosa</a>, <a href="https://nx.dev/" target="_blank" rel="noopener noreferrer" class="rp-link">Nx</a>, and <a href="https://valor-software.com/" target="_blank" rel="noopener noreferrer" class="rp-link">Valor</a>, Rspack has completed the compilation support for <a href="https://nestjs.com/" target="_blank" rel="noopener noreferrer" class="rp-link">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 class="rp-toc-include" id="dev-guide"><a href="#dev-guide" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Dev guide</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&#x27;s architecture, enabling contributors to gain a profound understanding of the project&#x27;s intricate inner workings.</p>
<h2 class="rp-toc-include" id="test-infrastructures"><a href="#test-infrastructures" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Test infrastructures</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 class="rp-toc-include" id="nightly-release"><a href="#nightly-release" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Nightly release</h2>
<p>In order to expedite iteration, Rspack is released daily with the &quot;@nightly&quot; tag to npm.</p>
<h2 class="rp-toc-include" id="acknowledgements"><a href="#acknowledgements" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Acknowledgements</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" class="rp-link">@TheLarkInn</a> and <a href="https://github.com/alexander-akait" target="_blank" rel="noopener noreferrer" class="rp-link">@alexander-akait</a>, for answering and resolving many of Rspack team&#x27;s questions about Webpack.</li>
<li><a href="https://github.com/zackarychapple" target="_blank" rel="noopener noreferrer" class="rp-link">@zackarychapple</a>, <a href="https://github.com/valorkin" target="_blank" rel="noopener noreferrer" class="rp-link">@valorkin</a>, <a href="https://github.com/edusperoni" target="_blank" rel="noopener noreferrer" class="rp-link">@edusperoni</a>, and <a href="https://github.com/Coly010" target="_blank" rel="noopener noreferrer" class="rp-link">@Coly101</a> for assisting the Rspack team with basic support for Angular and <a href="https://github.com/zackarychapple" target="_blank" rel="noopener noreferrer" class="rp-link">@zackarychapple</a> for reviewing this release blog.</li>
<li><a href="https://github.com/suxin2017" target="_blank" rel="noopener noreferrer" class="rp-link">@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" class="rp-link">@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" class="rp-link">@lippzhang</a>, for making numerous contributions in aligning Rspack&#x27;s behavior with Webpack.</li>
<li><a href="https://github.com/HerringtonDarkholme" target="_blank" rel="noopener noreferrer" class="rp-link">@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" class="rp-link">@dhruvkelawala</a>, for implementing the builtins.provide feature in Rspack.</li>
<li><a href="https://github.com/magic-akari" target="_blank" rel="noopener noreferrer" class="rp-link">@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" class="rp-link">@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 isPermaLink="false">/blog/announcing-0-1</guid>
            <pubDate>Mon, 06 Mar 2023 21:37:00 GMT</pubDate>
            <description><![CDATA[Rspack has officially been released!]]></description>
            <content:encoded><![CDATA[<!--$--><p><em>March 06, 2023</em></p>
<h1 class="rp-toc-include" id="announcing-rspack-01"><a href="#announcing-rspack-01" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Announcing Rspack 0.1<!-- --> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div>
<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 class="rp-toc-include" id="why-rspack"><a href="#why-rspack" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Why Rspack?</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&#x27;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 class="rp-toc-include" id="how-is-rspack-doing-now"><a href="#how-is-rspack-doing-now" class="rp-header-anchor rp-link" aria-hidden="true">#</a>How is Rspack doing now?</h2>
<p>The Rspack project started about 11 months ago. Although it&#x27;s still in the early stages, it can bring 5~10 times improvement to applications&#x27; 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&#x27;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 class="rp-toc-include" id="acknowledgement"><a href="#acknowledgement" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Acknowledgement</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" class="rp-link">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" class="rp-link">@sokra</a> for the great work on the <a href="https://github.com/webpack/webpack" target="_blank" rel="noopener noreferrer" class="rp-link">webpack</a> project.</li>
<li><a href="https://github.com/ScriptedAlchemy" target="_blank" rel="noopener noreferrer" class="rp-link">@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" class="rp-link">SWC</a> project created by <a href="https://github.com/kdy1" target="_blank" rel="noopener noreferrer" class="rp-link">@kdy1</a>, which powers Rspack&#x27;s code parsing, transformation and minification.</li>
<li>The <a href="https://github.com/evanw/esbuild" target="_blank" rel="noopener noreferrer" class="rp-link">esbuild</a> project created by <a href="https://github.com/evanw" target="_blank" rel="noopener noreferrer" class="rp-link">@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" class="rp-link">NAPI-RS</a> project created by <a href="https://github.com/Brooooooklyn" target="_blank" rel="noopener noreferrer" class="rp-link">@Brooooooklyn</a>, which powers Rspack&#x27;s node-binding implementation.</li>
<li>The <a href="https://github.com/parcel-bundler/parcel" target="_blank" rel="noopener noreferrer" class="rp-link">Parcel</a> project created by <a href="https://github.com/devongovett" target="_blank" rel="noopener noreferrer" class="rp-link">@devongovett</a> which is the pioneer of rust bundler and inspired Rspack&#x27;s incremental rebuild design.</li>
<li>The <a href="https://github.com/vitejs/vite" target="_blank" rel="noopener noreferrer" class="rp-link">Vite</a> project created by <a href="https://github.com/yyx990803" target="_blank" rel="noopener noreferrer" class="rp-link">Evan You</a> which inspired Rspack&#x27;s compatibility design of webpack&#x27;s ecosystem.</li>
<li>The <a href="https://github.com/rolldown-rs/rolldown" target="_blank" rel="noopener noreferrer" class="rp-link">Rolldown</a> project created by <a href="https://github.com/sponsors/rolldown-rs" target="_blank" rel="noopener noreferrer" class="rp-link">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" class="rp-link">html-webpack-plugin</a> project created by <a href="https://github.com/jantimon" target="_blank" rel="noopener noreferrer" class="rp-link">@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" class="rp-link">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" class="rp-link">Turbopack</a> project which inspired the ast path logic of Rspack.</li>
</ul>
<h2 class="rp-toc-include" id="future-plans"><a href="#future-plans" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Future plans</h2>
<h3 class="rp-toc-include" id="improve-basic-capabilities"><a href="#improve-basic-capabilities" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improve basic capabilities</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 class="rp-toc-include" id="working-with-community-partners"><a href="#working-with-community-partners" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Working with community partners</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 class="rp-toc-include" id="improve-plugin-capabilities"><a href="#improve-plugin-capabilities" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Improve plugin capabilities</h3>
<p>Rspack has supported most of the loader APIs, but only a few plugin APIs. There are two reasons why we haven&#x27;t supported them all. One is that some APIs are bad for performance, so we didn&#x27;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 class="rp-toc-include" id="continuously-improve-performance"><a href="#continuously-improve-performance" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Continuously improve performance</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 class="rp-toc-include" id="build-a-quality-assurance-system"><a href="#build-a-quality-assurance-system" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Build a quality assurance system</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 class="rp-toc-include" id="trial"><a href="#trial" class="rp-header-anchor rp-link" aria-hidden="true">#</a>Trial</h2>
<ul>
<li>Quick start: <a href="/guide/start/quick-start" class="rp-link">rspack.rs</a></li>
<li>GitHub Repo: <a href="https://github.com/web-infra-dev/rspack" target="_blank" rel="noopener noreferrer" class="rp-link">github.com/web-infra-dev/rspack</a></li>
</ul><!--/$-->]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rspack blogs]]></title>
            <link>https://rspack.rs/blog/</link>
            <guid isPermaLink="false">/blog/</guid>
            <description><![CDATA[Rspack blog archive covering release announcements, ecosystem updates, and technical articles from the team.]]></description>
            <content:encoded><![CDATA[<h1 class="rp-toc-include" id="rspack-blogs"><span>Rspack blogs</span><a href="#rspack-blogs" class="rp-header-anchor rp-link" aria-hidden="true">#</a> </h1><div class="rp-not-doc rp-llms-container"><button class="rp-not-doc rp-llms-button rp-llms-copy-button"><div class="rp-llms-copy-button__icon-wrapper"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-success"><path fill="currentColor" d="m9.55 18-5.7-5.7 1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" class="rp-llms-copy-button__icon-copy"><path fill="currentColor" d="M20 8v12H8V8zm0-2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2"></path><path fill="currentColor" d="M4 16H2V4a2 2 0 0 1 2-2h12v2H4Z"></path></svg></div><span>Copy Markdown</span></button><button class="rp-llms-button rp-llms-view-options__trigger "><svg width="1em" height="1em" viewBox="0 0 32 32" class="rp-llms-view-options__arrow "><path fill="currentColor" d="M16 22 6 12l1.4-1.4 8.6 8.6 8.6-8.6L26 12z"></path></svg></button></div><!--$--><p>Browse release notes, ecosystem updates, and technical deep dives from the Rspack team <a href="https://x.com/rspack_dev" target="_blank" rel="noopener noreferrer" class="rp-link">@rspack_dev</a>.</p>
<!-- -->
<div class="blogPage-QpKeWn rp-not-doc"><section class="featuredSection-Y3bjII"><a href="/blog/announcing-2-0" class="card-tONMLM featured-W4XJYg interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">April 22, 2026</span><div class="title-zAqg4x featuredTitle-BicFLy">Announcing Rspack 2.0</div><div class="description-WkXUDU featuredDescription-rgRiSD clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">Rspack 2.0 is out! It introduces more modern defaults, API design, and build outputs while remaining compatible with the webpack ecosystem.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a></section><section class="grid-Xrk9hS"><a href="/blog/announcing-1-7" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">December 31, 2025</span><div class="title-zAqg4x">Announcing Rspack 1.7</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">Rspack 1.7 has been released, improving SWC Wasm plugin compatibility, importing assets as bytes, and stabilizing multiple experimental features.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="/blog/announcing-1-6" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">October 30, 2025</span><div class="title-zAqg4x">Announcing Rspack 1.6</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">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></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="/blog/announcing-1-5" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">August 26, 2025</span><div class="title-zAqg4x">Announcing Rspack 1.5</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">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></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="https://github.com/orgs/web-infra-dev/discussions/29" target="_blank" rel="noopener noreferrer" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">July 31, 2025</span><div class="title-zAqg4x">Bundler tree shaking principles and differences</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">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></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="ahabhgk"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://github.com/ahabhgk.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">ahabhgk</div></div></div></a><a href="https://github.com/orgs/web-infra-dev/discussions/27" target="_blank" rel="noopener noreferrer" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">July 2, 2025</span><div class="title-zAqg4x">How to embed a HashMap with lots of strings in program</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">This article introduces techniques for constructing a completely static and efficient Map using MPHF and string packing, avoiding initialization, parsing, and memory allocation while improving binary size and compile speed.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="quininer"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://github.com/quininer.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">quininer</div></div></div></a><a href="/blog/announcing-1-4" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">June 26, 2025</span><div class="title-zAqg4x">Announcing Rspack 1.4</div><div class="description-WkXUDU clampedDescription-A_BULP"><span class="descriptionParagraph-xUjGh7">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 `CssChunkingPlugin`.</span></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="/blog/rspack-next-partner" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">April 10, 2025</span><div class="title-zAqg4x">Rspack joins the Next.js ecosystem</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">Today, we’re excited to introduce next-rspack, 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></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="/blog/announcing-1-3" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">March 28, 2025</span><div class="title-zAqg4x">Announcing Rspack 1.3</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">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></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="/blog/announcing-1-2" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">January 21, 2025</span><div class="title-zAqg4x">Announcing Rspack 1.2</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">Rspack 1.2 has been released, introducing experimental persistent caching, a faster code splitting algorithm, and Yarn PnP support.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="https://github.com/orgs/web-infra-dev/discussions/24" target="_blank" rel="noopener noreferrer" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">January 7, 2025</span><div class="title-zAqg4x">Build systems and bundlers</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">This article will briefly introduce the content of the &quot;Build Systems à la Carte: Theory and Practice&quot; paper and attempt to summarize bundlers from the perspective of build systems.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="ahabhgk"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://github.com/ahabhgk.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">ahabhgk</div></div></div></a><a href="https://github.com/orgs/web-infra-dev/discussions/23" target="_blank" rel="noopener noreferrer" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">January 6, 2025</span><div class="title-zAqg4x">RSC and Server Action bundle practice</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">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></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="ahabhgk"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://github.com/ahabhgk.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">ahabhgk</div></div></div></a><a href="/blog/announcing-1-1" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">November 7, 2024</span><div class="title-zAqg4x">Announcing Rspack 1.1</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">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></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="/blog/announcing-1-0-alpha" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">June 29, 2024</span><div class="title-zAqg4x">Announcing Rspack 1.0 alpha</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">Rspack 1.0 alpha is now available on npm! 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></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="/blog/announcing-1-0" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">June 29, 2024</span><div class="title-zAqg4x">Announcing Rspack 1.0</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">Today Rspack has reached a new milestone - 1.0. This means that Rspack is production-ready, covers most of webpack&#x27;s APIs and features, and is now prepared to support more users.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="/blog/announcing-0-7" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">May 28, 2024</span><div class="title-zAqg4x">Announcing Rspack 0.7</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">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></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="https://github.com/orgs/web-infra-dev/discussions/17" target="_blank" rel="noopener noreferrer" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">April 17, 2024</span><div class="title-zAqg4x">Deep dive into Rspack tree shaking</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">This article primarily focuses on understanding the concept of Rspack &amp; webpack tree shaking.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="hardfist"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://github.com/hardfist.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">hardfist</div></div></div></a><a href="/blog/announcing-0-6" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">April 10, 2024</span><div class="title-zAqg4x">Announcing Rspack 0.6</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">Rspack 0.6 is out, with built-in support for mini-css-extract-plugin and new tree-shaking enabled by default.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="https://github.com/orgs/web-infra-dev/discussions/15" target="_blank" rel="noopener noreferrer" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">January 12, 2024</span><div class="title-zAqg4x">Webpack chunk graph algorithm</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">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></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="JSerFeng"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://github.com/JSerFeng.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">JSerFeng</div></div></div></a><a href="/blog/announcing-0-5" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">January 9, 2024</span><div class="title-zAqg4x">Announcing Rspack 0.5</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">Rspack 0.5 is out, supporting Module Federation and removing the default SWC transformation.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="/blog/module-federation-added-to-rspack" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">January 9, 2024</span><div class="title-zAqg4x">Module Federation added to Rspack</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">The latest Rspack 0.5.0 introduces the highly anticipated Module Federation, which is detailed in this article.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="https://github.com/orgs/web-infra-dev/discussions/12" target="_blank" rel="noopener noreferrer" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">November 29, 2023</span><div class="title-zAqg4x">Webpack CSS order issue</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">This article shows how the CSS order problem occurs in webpack and how to solve it.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="JSerFeng"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://github.com/JSerFeng.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">JSerFeng</div></div></div></a><a href="/blog/announcing-0-4" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">November 22, 2023</span><div class="title-zAqg4x">Announcing Rspack 0.4</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">Rspack 0.4 is out, removing support for some builtin features.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="https://github.com/orgs/web-infra-dev/discussions/9" target="_blank" rel="noopener noreferrer" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">October 26, 2023</span><div class="title-zAqg4x">Deep dive into Top-level await</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">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></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="ulivz"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://github.com/ulivz.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">ulivz</div></div></div></a><a href="https://github.com/orgs/web-infra-dev/discussions/1" target="_blank" rel="noopener noreferrer" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">August 30, 2023</span><div class="title-zAqg4x">Design trade-offs in bundler</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">This article explains why we decided to develop Rspack and what trade-offs we made during the design process.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="hardfist"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://github.com/hardfist.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">hardfist</div></div></div></a><a href="/blog/announcing-0-3" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">August 24, 2023</span><div class="title-zAqg4x">Announcing Rspack 0.3</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">Rspack 0.3 is out, adding support for web workers and the builtin:swc-loader.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="/blog/announcing-0-2" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">June 2, 2023</span><div class="title-zAqg4x">Announcing Rspack 0.2</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">Rspack 0.2 is out, introducing many new features, such as support for realContentHash, DataURI, and the ESM format, and more.</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a><a href="/blog/announcing-0-1" class="card-tONMLM gridItem-W7_sGP interactiveCard-MMJbVF rp-link" data-tilt-card="true"><span class="date-Td1gj5">March 6, 2023</span><div class="title-zAqg4x">Announcing Rspack 0.1</div><div class="description-WkXUDU clampedDescription-A_BULP"><p class="descriptionParagraph-xUjGh7">Rspack has officially been released!</p></div><div class="footer-vhcqbm"><div class="compactGroup-Ij3Cuk avatarOverride-LGUxCZ" title="Rspack Team"><div class="compactAvatars-K_PsP6" aria-hidden="true"><img src="https://assets.rspack.rs/rspack/rspack-logo-with-background.png" alt="" class="compactAvatar-VpXzKi" loading="lazy" decoding="async"/></div><div class="compactNames-yJrKbP">Rspack Team</div></div></div></a></section><style>
      .rp-doc > h1 { font-weight: 700; }
      .rp-doc > p { color: var(--rs-blog-list-desc-color); }
      .rp-doc-layout__sidebar-placeholder { display: none; }
      .rp-doc-layout__outline { display: none; }
      .rp-doc-layout__doc { width: 100% !important; max-width: 100% !important; }
      .rp-doc-layout__doc-container { margin: 0 auto; }
      </style></div><div class="blogBackground-ESH_4Z"><div class="glowBackground-Pe6ULN"></div><div class="blogFrame-_M1lGW"></div><canvas style="position:absolute;top:0;left:0;width:100%;height:65vh;z-index:-1;filter:blur(.5px);opacity:0.8"></canvas></div><!--/$-->]]></content:encoded>
        </item>
    </channel>
</rss>