Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/docusaurus-faster/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"license": "MIT",
"dependencies": {
"@docusaurus/types": "3.10.1",
"@rspack/core": "^1.7.10",
"@rspack/core": "^2.0.1",
"@swc/core": "^1.15.32",
"@swc/html": "^1.15.32",
"browserslist": "^4.28.2",
Expand Down
35 changes: 10 additions & 25 deletions packages/docusaurus/src/webpack/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,16 @@ export async function createBaseConfig({
}
if (props.currentBundler.name === 'rspack') {
if (props.siteConfig.future.faster.rspackPersistentCache) {
// Use cache: true + experiments.cache.type: "persistent"
// See https://rspack.dev/config/experiments#persistent-cache
return true;
// Rspack v2: persistent cache moved from experiments.cache to top-level cache
// See https://rspack.dev/config/cache
return {
type: 'persistent',
// Rspack doesn't have "cache.name" like Webpack
// This is not ideal but work around is to merge name/version
// See https://github.com/web-infra-dev/rspack/pull/8920#issuecomment-2658938695
version: `${getCacheName()}-${getCacheVersion()}`,
buildDependencies: getCacheBuildDependencies(),
} as unknown as Configuration['cache'];
} else {
return disabledPersistentCacheValue;
}
Expand All @@ -149,32 +156,10 @@ export async function createBaseConfig({
};
}

function getExperiments(): Configuration['experiments'] {
if (props.currentBundler.name === 'rspack') {
// TODO find a way to type this
const experiments: any = {};

if (!process.env.DOCUSAURUS_NO_PERSISTENT_CACHE) {
experiments.cache = {
type: 'persistent',
// Rspack doesn't have "cache.name" like Webpack
// This is not ideal but work around is to merge name/version
// See https://github.com/web-infra-dev/rspack/pull/8920#issuecomment-2658938695
version: `${getCacheName()}-${getCacheVersion()}`,
buildDependencies: getCacheBuildDependencies(),
};
}

return experiments;
}
return undefined;
}

return {
mode,
name,
cache: getCache(),
experiments: getExperiments(),
output: {
pathinfo: false,
path: outDir,
Expand Down
3 changes: 2 additions & 1 deletion packages/docusaurus/src/webpack/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export default async function createServerConfig({
output: {
path: outputDir,
filename: outputFilename,
libraryTarget: 'commonjs2',
// rspack v2 dropped libraryTarget in favor of library.type
library: {type: 'commonjs2'},
},
plugins: [
new ProgressBarPlugin({
Expand Down
Loading
Loading