Skip to content
Merged
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/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"bump": "npx bumpp --no-tag"
},
"dependencies": {
"@rspack/core": "1.4.0-beta.0",
"@rspack/core": "1.4.0-beta.1",
"@rspack/lite-tapable": "~1.0.1",
"@swc/helpers": "^0.5.17",
"core-js": "~3.43.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/createRsbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { pluginExternals } from './plugins/externals';
import { pluginFileSize } from './plugins/fileSize';
import { pluginHtml } from './plugins/html';
import { pluginInlineChunk } from './plugins/inlineChunk';
import { pluginLazyCompilation } from './plugins/lazyCompilation';
import { pluginManifest } from './plugins/manifest';
import { pluginMinimize } from './plugins/minimize';
import { pluginModuleFederation } from './plugins/moduleFederation';
Expand Down Expand Up @@ -104,6 +105,7 @@ async function applyDefaultPlugins(
pluginManifest(),
pluginModuleFederation(),
pluginRspackProfile(),
pluginLazyCompilation(),
pluginSri(),
pluginNonce(),
]);
Expand Down
25 changes: 25 additions & 0 deletions packages/core/src/plugins/lazyCompilation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { RsbuildPlugin } from '../types';

export const pluginLazyCompilation = (): RsbuildPlugin => ({
name: 'rsbuild:lazy-compilation',

setup(api) {
api.modifyBundlerChain((chain, { environment, isProd, target }) => {
if (isProd || target !== 'web') {
return;
}

const { config } = environment;

const options = config.dev?.lazyCompilation;
if (!options) {
return;
}

chain.experiments({
...chain.get('experiments'),
lazyCompilation: options,
});
});
},
});
1 change: 0 additions & 1 deletion packages/core/src/server/devMiddlewares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ const applyDefaultMiddlewares = async ({
rspack.experiments.lazyCompilationMiddleware(
// TODO: support for multi compiler
isMultiCompiler(compiler) ? compiler.compilers[0] : compiler,
dev.lazyCompilation,
) as RequestHandler,
);
}
Expand Down
Loading
Loading