You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (props.currentBundler.name === 'rspack') {
// TODO Rspack only supports memory cache (as of Sept 2024)
// TODO re-enable file persistent cache one Rspack supports it
// See also https://rspack.dev/config/cache#cache
- return undefined;+ return true;
}
// @ts-expect-error: Rspack-only, not available in Webpack typedefs
incremental: !isProd && !process.env.DISABLE_RSPACK_INCREMENTAL,
+ cache: {+ type: 'persistent',+ // Some extra options+ },
};
Self-service
I'd be willing to do some initial work on this proposal myself.
I tried already but it didn't work yet. It did rebuild faster but then the SSG failed. At best, we could expose this through env variables but I suspect it will fail on all sites. I'll ping the Rspack team about this when I have time to investigate a bit more (not this week, taking a break)
You have already tried it, and it's bad news that it fails in SSG (I only tried it in preview with single locale by directly overwriting the JS file in node_modules).
The current API lacks name: `${name}-${mode}-${props.i18n.currentLocale}` (existing in Webpack), but is it fine?
The design of the API has not been confirmed. I see.
The type of buildDependencies is different too. Webpack is object but Rspack is array. Looks like it's not critical now because we have only to extract .config.
I noticed the release of beta from the subscribed direct notification from Rspack.
I don't think its persistent cache is compatible with the current Docusaurus.
The type of buildDependencies is different too. Webpack is object but Rspack is array.
Yes, the rspack configuration is designed differently than webpack and will not be compatible with webpack.
There are some reasons for this.
The architecture of rspack cache is completely different from webpack, which makes some configurations meaningless on rspack, such as memoryCacheUnaffected.
rspack cache needs to support more features in the future, such as remote cache.
@tats-u Currently loaderContext.emitFile is not saved to persistent cache, we will support it in the next version. You can use loaderContext.cacheable = false to force rebuilding those module, of course this will cause some performance degradation.
However there is a bug in Rspack cache that prevents many of our files to be cached properly (all the code-generated files, notably all those in .docusaurus).
Activity
slorber commentedon Jan 7, 2025
I tried already but it didn't work yet. It did rebuild faster but then the SSG failed. At best, we could expose this through env variables but I suspect it will fail on all sites. I'll ping the Rspack team about this when I have time to investigate a bit more (not this week, taking a break)
tats-u commentedon Jan 7, 2025
You have already tried it, and it's bad news that it fails in SSG (I only tried it in preview with single locale by directly overwriting the JS file in
node_modules).The current API lacks
name: `${name}-${mode}-${props.i18n.currentLocale}`(existing in Webpack), but is it fine?slorber commentedon Jan 7, 2025
It's an initial version, afaik they plan to support the same options as Webpack.
This cache
namefeature is indeed useful to create one cache per env (client/server) and locale (for i18n sites)See also my explanation here: web-infra-dev/rspack#5658 (comment)
BTW beta.0 is out right now: https://github.com/web-infra-dev/rspack/releases/tag/v1.2.0-beta.0
tats-u commentedon Jan 7, 2025
The design of the API has not been confirmed. I see.
The type of
buildDependenciesis different too. Webpack is object but Rspack is array. Looks like it's not critical now because we have only to extract .config.I noticed the release of beta from the subscribed direct notification from Rspack.
I don't think its persistent cache is compatible with the current Docusaurus.
jerrykingxyz commentedon Jan 9, 2025
Yes, the rspack configuration is designed differently than webpack and will not be compatible with webpack.
There are some reasons for this.
tats-u commentedon Jan 21, 2025
https://rspack.dev/config/experiments#migrating-from-webpack-config
You prepared a migration guide that covers all options used by Docusaurus, so it seems to be in acceptable range and we can try it once.
tats-u commentedon Jan 26, 2025
/assets/images(imported images and images in Markdown) may not be created for builds after persistent cache is enabled and reused.tats-u commentedon Jan 27, 2025
Does the persistent cache in Rspack save files generated by loaderContext.emitFile?
jerrykingxyz commentedon Jan 27, 2025
@tats-u Currently
loaderContext.emitFileis not saved to persistent cache, we will support it in the next version. You can useloaderContext.cacheable = falseto force rebuilding those module, of course this will cause some performance degradation.tats-u commentedon Jan 27, 2025
@jerrykingxyz Thank you for your quick response. That must be why. Does "next version" mean 1.3 as of now?
jerrykingxyz commentedon Jan 27, 2025
I am actually working on fixing this right now, but it's a bit of work and will be included in version 1.2.3 on February 11th.
tats-u commentedon Jan 27, 2025
Oh, you are going to release that feature in the next patch version. Much earlier than I thought. I appreciate your continuous quick work.
tats-u commentedon Jan 27, 2025
Then we have to bump
@rspack/corealpha to stable to accept that change in the near future.Looks like 1.2.2 works well with Docusaurus 3.7.
tats-u commentedon Jan 27, 2025
Created
moonwalk47 commentedon Feb 8, 2025
the more understanding i get about this the better it becomes
thanks :-)
tats-u commentedon Feb 11, 2025
1.2.3 has been released.
https://github.com/web-infra-dev/rspack/releases/tag/v1.2.3
This? I think the ball is in our court now.
web-infra-dev/rspack@7f11461#diff-4f349408e97f6b25e924bc599a06661d466fc7913ebed9fb6aa8ed05d7b9eb7aR329-R343
web-infra-dev/rspack@7f11461#diff-fd42ec611cd5acb13724f10d47d47067d31c35ae5a06062825c02fb81a1d8450R244
slorber commentedon Feb 11, 2025
Yes, I noted to ad a new Docusaurus Faster option once this gets released. Will work on it soon.
slorber commentedon Feb 21, 2025
I merged the persistent cache for v3.8
However there is a bug in Rspack cache that prevents many of our files to be cached properly (all the code-generated files, notably all those in
.docusaurus).I've documented this with benchmarks in #10931
I hope that they fix it soon so that we can announce better benchmarks when releasing v3.8
tats-u commentedon Feb 21, 2025
Hooray!
The bug you mention is web-infra-dev/rspack#9413.
I wonder if it will have been fixed.
slorber commentedon Mar 7, 2025
The new API could help but doesn't really fix the bug in my opinion.
See also my comment: web-infra-dev/rspack#9413 (comment)
And extra repros I created to explain our problem better:
slorber commentedon Apr 18, 2025
The Rspack 1.3.6 upgrade will improve the performance of the persistent cache.
Updated benchmarks available here: #11114