Releases: web-infra-dev/rspack
v0.3.4
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);
}
};
@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")
})
]
}
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
}
}
}
]
}
}
What's Changed
Performance Improvements β‘
- perf: optimize process assets by @jerrykingxyz in #4116
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
andkeepClassNames
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 π
- fix: console should not appear here by @h-a-n-a in #4145
- fix: vue3 hmr by @underfin in #4149
- fix: patch
sendStats
of webpack-dev-server by @h-a-n-a in #4101 - fix(css/modules): bump swc version to fix #3875 and add test by @Thiry1 in #4144
- fix: ignoreWarnings should work when call stats.getJson by @9aoy in #4153
- fix: export client dir in react-refresh-plugin by @ahabhgk in #4164
- fix: resolve async css chunk loading promise by @underfin in #4165
- fix: chunkLoading false by @underfin in #4167
- fix(core): add AbstractMethodError and fix references by @jkzing in #4170
- fix: perf regression caused by optimizeTree hook by @ahabhgk in #4185
Other Changes
- chore: format PR template by @ahabhgk in #4138
- chore: disable sync document when closed merge request by @hardfist in #4142
- chore: takedown down monaco-editor example build in ci by @hardfist in #4146
- test: snapshot css modules separately by @h-a-n-a in #4155
- chore: fix publish problems of react-refresh by @hardfist in #4161
- chore: add profile syntax comment by @ahabhgk in #4166
- refactor: naming to RspackPlugin by @ahabhgk in #4156
- ci: refine artifact publishing by @h-a-n-a in #4178
- chore: π€ remove unnecessary snapshot files by @IWANABETHATGUY in #4179
Full Changelog: v0.3.2...v0.3.4
v0.3.2
What's Changed
Exciting New Features π
- feat: FlagDependencyExports part 1 by @IWANABETHATGUY in #4045
- feat: moving builtins options to builtin plugins by @ahabhgk in #4012
- feat: implement HarmonyExportSpecifierDependency get_exports by @underfin in #4052
- feat: implement dependency get_referenced_exports by @underfin in #4069
- feat: expose
EntryPlugin
by @ahabhgk in #4073 - feat: provide exports p2 by @IWANABETHATGUY in #4057
- feat: expose
ExternalsPlugin
by @ahabhgk in #4083 - feat: export externals plugin and node target plugin, electron target plugin by @ahabhgk in #4094
- feat: initialize future flags by @h-a-n-a in #4107
- feat: Support passing string to splitChunks.{cacheGroup}.test by @Hamzakh777 in #3673
- feat(core): code generation module hash by @LingyuCoder in #4096
- feat(rspack_core): add oxc_resolver (turned off by default) by @Boshen in #4108
Bug Fixes π
- fix: source map not update when hmr by @ahabhgk in #4055
- fix: sort import var at wasm codegen by @underfin in #4071
- fix: umd analyze by @underfin in #4085
- fix: make dev-server compatible with globalThis by @ja-plus in #4087
- fix: upgrade swc by @hardfist in #4088
- fix(runtime): should calculate installed css chunks correctly by @hyf0 in #4072
- fix: align stats.modulesSpace default behaivor with webpack by @9aoy in #4095
- fix: avoid inject refresh runtime for it self by @underfin in #4092
- fix: css loading module should render initial_chunk_ids by @underfin in #4110
- fix: improve interoperability of rules with side-effects by @h-a-n-a in #4115
- fix:
builtin:swc-loader
does not report error correctly by @h-a-n-a in #4111 - fix: test snapshot path by @h-a-n-a in #4132
- fix: use module.rules.include to avoid runtime inject it self by @underfin in #4134
- fix: css loading initial chunks by @underfin in #4136
Other Changes
- chore: run oxlint on all files during lint-staged (for now) by @Boshen in #4053
- chore: improve code format by @SnowingFox in #4042
- chore: use cargo insta go generate snapshot by @hardfist in #4056
- chore: fix cache problem by @hardfist in #4058
- chore: move all snapshot to insta by @hardfist in #4061
- chore: takedown node14 test on windows by @hardfist in #4068
- chore: skip empty test folder by @hardfist in #4077
- ci: only run
merge_group
tests on check being requested by @h-a-n-a in #4086 - revert: "ci: reduce binary size" by @h-a-n-a in #4090
- ci: take down windows test by @h-a-n-a in #4100
- chore: Upgraded
semver
to6.3.1
by @GarrisonD in #4102 - chore: refactor exports info by @IWANABETHATGUY in #4104
- chore: add license check by @hardfist in #4097
- ci: take down windows test, again by @h-a-n-a in #4109
- revert: apply entry and externals eagerly by @ahabhgk in #4105
- chore: increase windows ci test timeout minutes by @underfin in #4122
- chore: expose statsModule.nameForCondition by @9aoy in #4119
- chore: π€ align webpack factory meta by @IWANABETHATGUY in #4125
- chore: add documenation link notice of pull request template by @hardfist in #4106
- chore: use cross-env by @h-a-n-a in #4130
- refactor: zod schema and normalized types by @ahabhgk in #4098
New Contributors
- @SnowingFox made their first contribution in #4042
- @ja-plus made their first contribution in #4087
Full Changelog: v0.3.1...v0.3.2
v0.3.1
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');
What's Changed
Performance Improvements β‘
- perf: reduce BuildMeta size by @underfin in #4027
- perf: reduce ModuleGraphModule memory size by @underfin in #4034
- perf: merge HarmonyImportSideEffectDependency into HarmonyImportDependency by @underfin in #4037
- perf: reduce task structs memory size by @underfin in #4035
Exciting New Features π
- feat(webpack-tree-shaking): side effects plugin by @IWANABETHATGUY in #4007
- feat: merge same init fragments by @underfin in #4004
- feat: cjs analyze by @underfin in #3962
- feat: add HarmonyImportSideEffectDependency by @underfin in #4010
- feat: support option
resolveLoader
by @h-a-n-a in #4008 - feat: export
Watching
type by @hardfist in #4014 - feat: support
ident
for builtin loader by @h-a-n-a in #4038
Bug Fixes π
- fix: disable DevtoolPlugin when options.devtool=false by @LingyuCoder in #4005
- fix(runtime): should calculate
initial_chunks
correctly by @hyf0 in #4022 - fix: tree shaking transitive bailout by @IWANABETHATGUY in #4017
- fix: add workaround for accessing previous stats by @h-a-n-a in #4028
Other Changes
- chore: add benchmark test for merge queue by @jerrykingxyz in #3995
- chore: update benchmark website by @hardfist in #4025
- ci: reduce binary size by @h-a-n-a in #4018
- refactor: changed ModuleGraph dependencies to BoxDependency by @underfin in #4026
- chore: fix html test by @hardfist in #4023
- refactor(rspack_loader_runner): remove nodejs_resolver dependency by @Boshen in #3982
- revert: "fix: getHash occasionally panic when rebuild (#3970)" by @h-a-n-a in #4029
- chore: fix nestjs example by @hardfist in #4011
- refactor: add InitFragment trait by @underfin in #4046
- refactor(rspack_core): implement resolver proxy by @Boshen in #4048
Full Changelog: v0.3.0...v0.3.1
v0.3.0
Rspack 0.3.0 is out!
Read the announcement blog post: Announcing Rspack 0.3.
Overview
- Removing built-in CSS transformation logic
- Web Workers Support
- Builtin swc-loader support
- Improved Profile Support
- Modern.js Vue.js Support
- Align Codegen architecture with Webpack
- More Hook and Plugin Support
What's Changed
Performance Improvements β‘
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 π
Other Changes
- chore: move binding utils by @h-a-n-a in #3964
- chore: test multi pull request template by @hardfist in #3971
- chore: sync doc when add need documentation label by @hardfist in #3975
- chore: sync doc when add need documentation label by @hardfist in #3976
- chore: test label by @hardfist in #3977
- chore: test label by @hardfist in #3978
- chore: add release scope by @hardfist in #3979
- chore: support nodejs benchmark by @jerrykingxyz in #3983
- chore: remove benchmark test on merge_group by @jerrykingxyz in #3987
- chore: add postcss-loader-example by @hardfist in #3992
- chore: benchmark pr remove useless inputs by @jerrykingxyz in #3994
- chore: add oxlint by @Boshen in #3999
- chore: add condition to module graph connection by @IWANABETHATGUY in #3989
- release: 0.3.0 by @hyf0 in #3861
- chore: fix workspace dep by @hardfist in #4021
New Contributors
Full Changelog: v0.2.12...v0.3.0
v0.2.12
What's Changed
Performance Improvements β‘
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 π
- fix: css compilation should fail if
experiments.css
sets to off by @h-a-n-a in #3430 - fix: tree shaking visit dynamic prop by @IWANABETHATGUY in #3929
- fix: import export all as is empty module by @IWANABETHATGUY in #3904
- fix: umd externals assets error by @KyrieLii in #3933
- fix(core): remove webpack-dev-server from @rspack/core by @hardfist in #3938
- fix(core): fix missing source_info in esm module error by @hardfist in #3899
- fix: nested import follow a export all symbol by @IWANABETHATGUY in #3947
- fix: fix trace subscriber for dev by @h-a-n-a in #3948
- fix: nested import with export imported dependency by @IWANABETHATGUY in #3951
Other Changes
- chore: nest example support hmr by @hardfist in #3930
- chore: add close-issues bot by @hardfist in #3935
Full Changelog: v0.2.11...v0.2.12
v0.2.11
What's Changed
Exciting New Features π
- feat: create fake namespace object for import context module by @underfin in #3871
- feat: ExportInfoApiDependency by @IWANABETHATGUY in #3882
- feat: add more context for error frame by @IWANABETHATGUY in #3892
- feat: stats logging by @ahabhgk in #3893
- feat: stats logging, part 2 by @ahabhgk in #3905
- feat: more generic nested import by @IWANABETHATGUY in #3895
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
- refactor: css-import span should be calculated with at-rule by @h-a-n-a in #3852
- refactor: parse result remove ast by @underfin in #3880
- chore: fix example code by @daydayhappychao in #3887
- refactor: dependency codegen use exports_info api by @underfin in #3894
- revert: "fix: modify Configuration type to support MultiRspackOptions" by @ahabhgk in #3902
- chore: add deprecate message in rspack-dev-middleware readme by @ahabhgk in #3911
- test: migrate inner-graph test by @IWANABETHATGUY in #3906
New Contributors
- @daydayhappychao made their first contribution in #3887
- @suica made their first contribution in #3831
Full Changelog: v0.2.10...v0.2.11
v0.2.10
What's Changed
Performance Improvements β‘
Exciting New Features π
- feat: add some exports info api by @underfin in #3844
- feat: implement dependency resource_identifier by @underfin in #3855
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
- chore: use dep_id instead of module id by @IWANABETHATGUY in #3839
- refactor: remove ctxt of variable in import map by @IWANABETHATGUY in #3869
- chore: bump swc version by @Thiry1 in #3868
New Contributors
Full Changelog: v0.2.9...v0.2.10
v0.2.9
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 π
- fix(core): Typo in html builtins types by @tobua in #3786
- fix: check symbol used by @underfin in #3790
- fix: compilation hash should hash hot index to avoid hmr loop by @underfin in #3794
- fix: tree shaking with a cyclic reference by @IWANABETHATGUY in #3789
- fix: shorthand filed symbol unsed by @underfin in #3797
- fix: react class component hmr by @underfin in #3801
- fix: fix css semicolon replacement by @h-a-n-a in #3804
- fix: react refresh false shouldn't inject react refresh runtime by @underfin in #3817
- fix: original source should respect to the module type by @h-a-n-a in #3822
- fix: css asset tree shaking by @underfin in #3818
- fix: error in plugin apply is not be reported when using cli by @ahabhgk in #3780
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
andcargo 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
What's Changed
Exciting New Features π
- feat: support ensure_chunk_conditions_plugin by @suxin2017 in #3502
Bug Fixes π
- fix: avoid rspack_plugin_ensure_chunk_conditions loop by @underfin in #3779
- fix: export named as code generation with tree shaking. by @IWANABETHATGUY in #3781
- fix: hmr should work for inject css link to body by @underfin in #3782
Other Changes
- chore: disable missing export warning by @IWANABETHATGUY in #3769
- chore: better unused debug info by @IWANABETHATGUY in #3772
- chore: fix remove sourcemap not working in release package by @hardfist in #3778
Full Changelog: 0.2.7...0.2.8
0.2.7
What's Changed
Performance Improvements β‘
- perf: convert to RawSource in devtool to reduce one time source map calculation when convert to JsCompatSource by @ahabhgk in #3748
Exciting New Features π
Bug Fixes π
- fix(rspack_core): context delete file by @LingyuCoder in #3749
- fix: should escape css url content by @ahabhgk in #3757
- fix: react refresh module id by @ahabhgk in #3763
Other Changes
- refactor: rename
CodeGeneratableDependency
toDependencyTemplate
for more consistency by @hyf0 in #3751 - chore: serialize the graph for better debugging. by @IWANABETHATGUY in #3752
- chore: bump Rust dependencies by @Boshen in #3728
- chore: add @ScriptedAlchemy to Rspack core by @Boshen in #3758
Full Changelog: 0.2.6...0.2.7