Skip to content

v1.2.0-alpha.0

Latest
Compare
Choose a tag to compare
@jerrykingxyz jerrykingxyz released this 30 Dec 10:49
· 34 commits to main since this release

Highlights πŸ’‘

Support for persistent cache

Rspack v1.2 introduced an experimental cache configuration that supports persistent caching, which can significantly improve hot startup speed.

When a build hits the cache, it can bring up to 60% performance improvement in real projects.

// rspack.config.js
module.exports = {
  cache: true,
  experiments: {
    cache: {
      type: 'persistent',
    },
  },
};

Note that the persistent cache is still in an early experimental stage and there is a lot of room for performance improvement.

No longer watching node_modules

Rspack v1.2 no longer watching the node_modules directory by default. This can greatly reduce the number of files to watch and improve performance.

According to our benchmark repo, this change will:

  • Reduce memory usage by 120MB.
  • Increase dev startup speed by 40%.
  • Increase HMR speed by 20~30%.

This change will not affect symlinked resources in monorepo, as symlinked resources are resolved to their real path by default.

Related PR: perf: ignore watching files in node_modules by @chenjiahan in #8645

Upgrade to SWC 9.0

The Rust crate swc_core has been upgraded to 9.0.2. Users of the SWC Wasm plugin need to ensure version consistency with the swc_core being used, otherwise, it may lead to unforeseen issues.

For more details, see SWC Plugin Version Unmatched.

Related PR: feat(core)!: bump swc_core to 9.0.0 by @andersk in #8639

Reduced memory usage

We have optimized the data structure used to store strings during the rspack-sources 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.

Related PR: perf: reduce memory consumption of CachedSource by @h-a-n-a in #8666

Reduced bundle size

Rspack v1.2.0 set default SWC minimizer passes to 2 to reduce bundle size by 1%-7%.

passes is the the maximum number of times to run compress. In some cases, more than one pass leads to further compressed code. Given Rspack's inherent speed, we've determined that using 2 passes by default strikes an optimal balance between build performance and bundle size.

Related PR: feat: set default SWC minimizer passes to 2 to reduce bundle size by @chenjiahan in #8853

Parallelize side effects optimization

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.

Related PR: perf: parallelize side effects optimization by @ahabhgk in #8781

Disable WarnCaseSensitiveModulesPlugin by default

The WarnCaseSensitiveModulesPlugin will check the paths of modules and issue warnings for modules that conflict when their paths are all in lowercase. We used to enable it by default, but since it is only a "linter" plugin and it has additional performance overhead especially in development mode. So now we disable it by default, and recommend to use WarnCaseSensitiveModulesPlugin to add it to your own needs.

// rspack.config.js
module.exports = {
  plugins: [new rspack.WarnCaseSensitiveModulesPlugin()],
};

Related PR: feat: export WarnCaseSensitiveModulesPlugin and disable it by default by @ahabhgk in #8697

What's Changed

Performance Improvements ⚑

  • perf: remove tokio-console to reduce binary size by @chenjiahan in #8681
  • perf: bump miette v7 to reduce binary size by @chenjiahan in #8694
  • perf(incremental): compute affected cgm incrementally by @ahabhgk in #8688
  • perf: reduce memory consumption of CachedSource by @h-a-n-a in #8666
  • perf: faster substring of rspack-sources by @h-a-n-a in #8731
  • perf: side effects when there aren't too many optimizable dependencies by @ahabhgk in #8746
  • perf: parallelize side effects optimization by @ahabhgk in #8781
  • perf(deps): bump fast-glob to v0.4.1 by @shulaoda in #8800
  • perf: improve FlagDependencyExportsPlugin for large JSON by depth by @hai-x in #8802
  • perf(incremental): better parallel for side effects plugin rebuild by @ahabhgk in #8848
  • perf(cli): remove Node.js semver checker by @chenjiahan in #8855
  • perf(cli): lazy import rechoir and interpret by @chenjiahan in #8856

Exciting New Features πŸŽ‰

Bug Fixes 🐞

  • fix: external module move out initial chunk by @SyMind in #8644
  • fix: escape css by @JSerFeng in #8698
  • fix: the wrong filename was passed when calling the assetEmitted hook by @inottn in #8709
  • fix: module concatenation for dynamic export info by @ahabhgk in #8730
  • fix: duplicate move lock files by @LingyuCoder in #8732
  • fix: fix nightly release compare-before-emit-disable test failed by @jerrykingxyz in #8739
  • fix: mf parse range not compat with safari by @ahabhgk in #8749
  • fix: incremental rebuild are compatible with empty artifact by @jerrykingxyz in #8758
  • fix: correct type for loaderContext.importModule by @chenjiahan in #8766
  • fix: allow empty persistent cache options by @h-a-n-a in #8813
  • fix: use cgm hash to verify rename inline modules cache by @ahabhgk in #8820
  • fix: Rspack cssParser will parse failed when url(' ') by @cbbfcd in #8824
  • fix(diagnostic): improve diagnostics for swc wasm plugins when mismatch by @SyMind in #8001
  • fix!: handle glob patterns ending with /** in CopyRspackPlugin by @inottn in #8803
  • fix(exernals): add hash to distinguish conflict id by @fi3ework in #8834
  • fix: importModule should receive error correctly by @JSerFeng in #8827
  • fix(rspack-test-tools): use process.cwd() when outside Rspack by @colinaaa in #8845
  • fix(incremental): build chunk graph with runtime chunk true by @ahabhgk in #8866
  • fix: persistent cache save ModuleArgumentDependency.id by @jerrykingxyz in #8870
  • fix(incremental): activate inactive module not codegen by @ahabhgk in #8871
  • fix: should recognize negative preload value by @JSerFeng in #8862
  • fix: correct css modules hashing to match Webpack when leading digit #8735 by @daveskybet in #8778
  • fix: rspack_version macro support match alpha version by @jerrykingxyz in #8880

Document Updates πŸ“–

Other Changes

New Contributors

Full Changelog: v1.1.8...v1.2.0-alpha.0