Skip to content

Releases: web-infra-dev/rspack

v0.3.5

27 Sep 01:21
Compare
Choose a tag to compare

Highlights

rspackFuture.disableTransformByDefault

Default transformation was a default strategy for transform introduced v0.1.x. This introduced ton of problems during our daily development. For example, excluding node_modules for certain libraries are not supported, thus, which results in some mis-transformations.
From now on, you can opt-in experiments.rspackFuture.disableTransformByDefault = true to disable the internal transformations. This greatly aligns Rspack with Webpack architecture. By enabling this option, these few options are not able to use anymore:

Builtin types(Rule.type) are removed in favor of webpack's web-standard bundling:

  • jsx, jsx/auto, jsx/esm, jsx/dynamic
  • ts, tsx

We will come up a new strategy to add back these DX friendly features in the future.
Instead, builtin:swc-loader is added for fine-grained transformation.
Please refer to this guide for the migration and details.

react-refresh migration

In this version, we'd like to introduce a better way to enable react fast refresh with @rspack/plugin-react-refresh, which is more powerful and flexible than builtins.react.refresh = true, now you can use it with builtin:swc-loader, swc-loader, or babel-loader.
Checkout docs for more details

Deprecating builtin:sass-loader

builtin:sass-loader is deprecated in favor of sass-loader. You can still use it in this and the next minor version. It will be officially removed in v0.5.0. See this for our deprecation stages.

Optimize the progress bar style

  • Thinner and shorter lines
  • Removed progress text
  • Green color

Preview:

Screen.Recording.2023-09-15.at.17.44.51.mov

What's Changed

Something

Performance Improvements ⚑

Exciting New Features πŸŽ‰

Bug Fixes 🐞

  • fix: shouldn't always apply react refresh plugin by @ahabhgk in #4194
  • fix: fix module source-map by @h-a-n-a in #4200
  • fix: remove react from rspackExperiments of builtin:swc-loader by @h-a-n-a in #4221
  • fix: merge disableReactRefreshByDefault to disableTransformByDefault by @ahabhgk in #4220
  • fix: missing rspack-only plugins on compiler.webpack by @ahabhgk in #4223
  • fix: filter export imported specifier used name . by @IWANABETHATGUY in #4229
  • fix: fix react-refresh self is not defined by @h-a-n-a in #4232
  • fix: react refresh test windows failed by @ahabhgk in #4242
  • fix: avoid double react refresh transform in rspack-dev-server by @ahabhgk in #4243
  • fix: passing option as &str caused memory leak in builtin:swc-loader by @h-a-n-a in #4235
  • fix(chore): fix node path compatible problem & add express example by @hardfist in #4248
  • fix: $RefreshReg$ is not defined error in node_modules by @ahabhgk in #4251

Other Changes

Full Changelog: v0.3.4...v0.3.5

v0.3.4

13 Sep 09:29
Compare
Choose a tag to compare

Highlight

Internal plugins

To further improve Rspack's compatibility with webpack ecosystem, we implemented internal plugins in Rspack.
For example, you can use rspack.XxxPlugin in your configuration.

const rspack = require('@rspack/core');

module.exports = {
  plugins: [
    new rspack.DefinePlugin({ 'process.env.NODE_ENV': "'production'", }),
    // In addition to webpack's existing plugins, some of the plugins implemented
    // in rust in Rspack are also exported by internal plugins
    new rspack.HtmlRspackPlugin({ template: './index.html' }),
  ],
};

Or use compiler.webpack.XxxPlugin in your plugin.

class ReactRefreshRspackPlugin {
  apply(compiler) {
    const reactRefreshPath = require.resolve("../client/reactRefresh.js");
    const reactRefreshEntryPath = require.resolve("../client/reactRefreshEntry.js");
    new compiler.webpack.EntryPlugin(compiler.context, reactRefreshEntryPath, {
      name: undefined
    }).apply(compiler);
    new compiler.webpack.ProvidePlugin({
      $ReactRefreshRuntime$: reactRefreshPath
    }).apply(compiler);
  }
};

See

@rspack/plugin-react-refresh

Thanks to the implementation of internal plugins, we can now easily implement the @rspack/plugin-react-refresh, which was coupled into @rspack/dev-server before.
Now, if you are using a custom dev server instead of @rspack/dev-server or @rspack/cli, you can easily enable react fast refresh by adding the @rspack/plugin-react-refresh plugin.
See

Compatible with html-webpack-plugin

Rspack is now html-webpack-plugin compatible!

const path = require("node:path")
const HtmlWebpackPlugin = require("html-webpack-plugin")

module.exports = {
  plugins: [
    new HtmlWebpackPlugin({
      template: "pug-loader!" + path.join(__dirname, "template.pug")
    })
  ]
}

See

builtin:swc-loader supports builtin transformations

These fields served as the alternative to the current builtin transform options, aiming to support transforming with respect to the certain module.

type RspackExperiments = {
  react?: ReactOptions;
  import?: PluginImportOptions;
  emotion?: EmotionOptions;
  relay?: RelayOptions;
};

For example, integrating emotion transformation in the project:

module.exports = {
  module: {
    rules: [
      {
         test: /\.jsx$/,
         exclude: /node_modules/,
         loader: "builtin:swc-loader",
         options: {
            jsc: {
              parser: {
                syntax: "ecmascript",
                jsx: true,
              }
            },
            rspackExperiments: {
              emotion: true
            }
         }
      }
    ]
  }
}

See

What's Changed

Performance Improvements ⚑

Exciting New Features πŸŽ‰

  • feat: flagDependencyUsagePlugin by @IWANABETHATGUY in #4114
  • feat(core): add cache hits info to stats by @LingyuCoder in #4140
  • feat: HarmonyExportImportedSpecifierDependency get mode by @underfin in #4141
  • feat: support builtin:swc-loader experimental transformers by @h-a-n-a in #4133
  • feat: support stats ids by @ahabhgk in #4148
  • feat: support function for BannerPlugin by @ahabhgk in #4151
  • feat: react refresh plugin by @ahabhgk in #4135
  • feat: expose keepFnNames and keepClassNames options of builtin swc minfier by @xinxinhe1810 in #4121
  • feat(config): warn while using experiments.newSplitChunks by @hyf0 in #4169
  • feat(config): only warn while experiments.newSplitChunks being explicitly setted by @hyf0 in #4174
  • feat: compatible with html-webpack-plugin by @ahabhgk in #4175
  • feat: combine three tree shaking related plugin, and add corresponding configuration. by @IWANABETHATGUY in #4147
  • feat: add externalsPresets webAsync target support by @lippzhang in #4184
  • feat: add boolean type for builtins.html[0].inject by @lippzhang in #3771

Bug Fixes 🐞

Other Changes

Full Changelog: v0.3.2...v0.3.4

v0.3.2

13 Sep 04:15
Compare
Choose a tag to compare

What's Changed

Exciting New Features πŸŽ‰

Bug Fixes 🐞

Other Changes

New Contributors

Full Changelog: v0.3.1...v0.3.2

v0.3.1

29 Aug 11:53
Compare
Choose a tag to compare

Highlight

Support option resolveLoader

With this option, you can specify the resolving strategy for each loader.

For example, if you are developing a loader and want to showcase its usage from a user's perspective in an example, you can write:

module.exports = {
  resolveLoader: {
    alias: {
      'amazing-loader': require.resolve('path-to-your-amazing-loader'),
    },
  },
};

Then, in the example code, you can write:

require('!!amazing-loader!./amazing-file.js');

See more

What's Changed

Performance Improvements ⚑

Exciting New Features πŸŽ‰

Bug Fixes 🐞

Other Changes

Full Changelog: v0.3.0...v0.3.1

v0.3.0

24 Aug 06:20
Compare
Choose a tag to compare

Rspack 0.3.0 is out!

Read the announcement blog post: Announcing Rspack 0.3.

Overview

What's Changed

Performance Improvements ⚑

  • perf: reduce memory size of const dependency and dependency type by @underfin in #3972

Exciting New Features πŸŽ‰

  • feat: add profile switch in cli by @ahabhgk in #3937
  • feat(chunkIds): support optimization.chunkIds: 'deterministic' by @nebarf in #3053
  • feat: add logging when RSPACK_PROFILE enabled by @ahabhgk in #3965
  • feat(core): expose RuntimeGlobals by @lippzhang in #3973
  • feat: support dispatching builtin loaders on Node by @h-a-n-a in #3980
  • feat: add timestamp on profile dist by @ahabhgk in #3985
  • feat: support builtin loader with inline loader syntax by @h-a-n-a in #3988
  • feat: support resolving builtin loaders in Rust tests by @h-a-n-a in #3998

Bug Fixes 🐞

  • fix: getHash occasionally panic when rebuild by @ahabhgk in #3970

Other Changes

New Contributors

Full Changelog: v0.2.12...v0.3.0

v0.2.12

15 Aug 06:45
Compare
Choose a tag to compare

What's Changed

Performance Improvements ⚑

  • perf: reduce compilation.getAssets overhead by @h-a-n-a in #3934

Exciting New Features πŸŽ‰

  • feat: support minifyOptions.asciiOnly by @9aoy in #3915
  • feat: add more logger.time in plugins by @ahabhgk in #3916
  • feat: support configuration.profile by @ahabhgk in #3924
  • feat(chunkIds): align chunkIds: 'named' with Webpack by @hyf0 in #3923
  • feat: support minifyOptions.comments by @9aoy in #3927
  • feat: support more predefined processAssets stage on js side by @ahabhgk in #3942

Bug Fixes 🐞

Other Changes

Full Changelog: v0.2.11...v0.2.12

v0.2.11

08 Aug 06:09
Compare
Choose a tag to compare

What's Changed

Exciting New Features πŸŽ‰

Bug Fixes 🐞

  • fix: render library runtime for include entry chunks by @underfin in #3876
  • fix: modify Configuration type to support MultiRspackOptions by @suica in #3831
  • fix(core): add resove failing reason for import in esm file by @hardfist in #3884
  • fix: HarmonyImportSpecifierDependency interop should scan xxx.xxx by @underfin in #3910
  • fix: fix a panic issue of get_hash if assertion is failed by @h-a-n-a in #3907
  • fix: should generate diffrent name for chunk asset at hmr by @underfin in #3912

Other Changes

New Contributors

Full Changelog: v0.2.10...v0.2.11

v0.2.10

01 Aug 04:25
Compare
Choose a tag to compare

What's Changed

Performance Improvements ⚑

Exciting New Features πŸŽ‰

Bug Fixes 🐞

  • fix: export imported a import declaration with all as. by @IWANABETHATGUY in #3847
  • fix: banner shouldn't be injected to asset by @hardfist in #3809
  • fix: generate correct name for library umd define by @underfin in #3856
  • fix: should replace _webpack_require to _nested_webpack_require at … by @underfin in #3857

Other Changes

New Contributors

Full Changelog: v0.2.9...v0.2.10

v0.2.9

25 Jul 12:00
Compare
Choose a tag to compare

What's Changed

Exciting New Features πŸŽ‰

  • feat(splitChunks): support splitChunks.{cacheGroup}.idHint by @hyf0 in #3783
  • feat(core): add test/include/exclude options to builtins.minifyOptions by @LingyuCoder in #3775
  • feat: support stats option "source" by @suxin2017 in #3682
  • feat(packages/rspack): add version check for binding by @lippzhang in #3717
  • feat: nested import tree shaking by @IWANABETHATGUY in #3800
  • feat: implement statsFactory and simplified DefaultStatsFactoryPlugin by @9aoy in #3805

Bug Fixes 🐞

Other Changes

  • ci: release canary without debug mode because binary size is too big to upload (>1G) by @Boshen in #3788
  • chore: fix canary release by @h-a-n-a in #3792
  • chore: support passing ref to reusable build by @h-a-n-a in #3793
  • chore: bump swc version by @h-a-n-a in #3791
  • chore: enable some runtime & context module webpack test by @underfin in #3796
  • ci: split cargo check and cargo test into two jobs by @Boshen in #3807
  • chore: remove rspack_build by @Boshen in #3806
  • refactor: assign dep id for each symbol. by @IWANABETHATGUY in #3808
  • chore: use v0.x.y instead of 0.x.y for release tag by @hardfist in #3819
  • test: basic webpack side effects and treeshaking tests by @IWANABETHATGUY in #3833
  • chore(types): should not return null when only called rspack with one parameter by @9aoy in #3835

New Contributors

Full Changelog: 0.2.8...v0.2.9

0.2.8

18 Jul 04:48
Compare
Choose a tag to compare

What's Changed

Exciting New Features πŸŽ‰

Bug Fixes 🐞

Other Changes

Full Changelog: 0.2.7...0.2.8