feat: add bundle analysis support
Add `webpack-bundle-analyzer` and a new `analyze` script to allow visualizing bundle composition via `npm run analyze`.
This commit is contained in:
+26
-21
@@ -1,7 +1,8 @@
|
||||
import { defineConfig } from '@rsbuild/core';
|
||||
import { pluginBabel } from '@rsbuild/plugin-babel';
|
||||
import { pluginSolid } from '@rsbuild/plugin-solid';
|
||||
import tailwindcss from '@tailwindcss/postcss';
|
||||
import { defineConfig } from "@rsbuild/core";
|
||||
import { pluginBabel } from "@rsbuild/plugin-babel";
|
||||
import { pluginSolid } from "@rsbuild/plugin-solid";
|
||||
import tailwindcss from "@tailwindcss/postcss";
|
||||
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
@@ -16,32 +17,36 @@ export default defineConfig({
|
||||
plugins: [tailwindcss()],
|
||||
},
|
||||
},
|
||||
rspack: {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.md|\.yarn|\.csv$/,
|
||||
exclude: /\.schema\.csv$/,
|
||||
type: 'asset/source'
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
rspack: {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.md|\.yarn|\.csv$/,
|
||||
exclude: /\.schema\.csv$/,
|
||||
type: "asset/source",
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
process.env.ANALYZE ? new BundleAnalyzerPlugin() : undefined,
|
||||
].filter(Boolean),
|
||||
},
|
||||
},
|
||||
html: {
|
||||
template: './src/index.html',
|
||||
template: "./src/index.html",
|
||||
},
|
||||
source: {
|
||||
entry: {
|
||||
index: './src/main.tsx',
|
||||
index: "./src/main.tsx",
|
||||
},
|
||||
},
|
||||
output: {
|
||||
distPath: {
|
||||
root: 'dist/web',
|
||||
root: "dist/web",
|
||||
},
|
||||
copy: process.env.NODE_ENV === 'development' ? [
|
||||
{ from: './content', to: 'content' }
|
||||
] : [],
|
||||
copy:
|
||||
process.env.NODE_ENV === "development"
|
||||
? [{ from: "./content", to: "content" }]
|
||||
: [],
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user