Skip to content

Commit

Permalink
feat: split lazy compilation case
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Nov 27, 2024
1 parent b5aac51 commit 86e8394
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions benchmark.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ const buildTools = [
"build:rspack",
"@rspack/cli/bin/rspack.js"
),
new BuildTool(
"Rspack CLI (Lazy Compilation) " +
require("@rspack/core/package.json").version,
8080,
"start:rspack:lazy",
/in (.+) (s|ms)/,
"build:rspack",
"@rspack/cli/bin/rspack.js"
),
// new BuildTool(
// "Farm " + require("@farmfe/core/package.json").version,
// 9000,
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"start:webpack": "NODE_ENV=development webpack serve --mode development",
"build:webpack": "NODE_ENV=production webpack build --mode production",
"start:rspack": "NODE_ENV=development rspack serve",
"start:rspack:lazy": "NODE_ENV=development LAZY=true rspack serve",
"build:rspack": "NODE_ENV=production rspack build",
"start:rsbuild": "rsbuild dev",
"build:rsbuild": "rsbuild build",
Expand Down
4 changes: 2 additions & 2 deletions rspack.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export default defineConfig({
],
},
plugins: [
new rspack.HtmlRspackPlugin({ template: "./index.webpack.html" }),
new rspack.HtmlRspackPlugin({ template: "./index.rspack.html" }),
!isProduction && new ReactRefreshPlugin(),
].filter(Boolean),
experiments: {
css: true,
lazyCompilation: !isProduction, // lazyCompilation should only be enabled in development mode
lazyCompilation: Boolean(process.env.LAZY) && !isProduction, // lazyCompilation should only be enabled in development mode
},
});
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
plugins: [
new MiniCssExtractPlugin(),
new HtmlWebpackPlugin({
template: "./index.webpack.html",
template: "./index.rspack.html",
}),
isProd ? null : new ReactRefreshWebpackPlugin(),
].filter(Boolean),
Expand Down

0 comments on commit 86e8394

Please sign in to comment.