我们在 vite 中开发了一个应用程序,我想分析应用程序包,我找到了 rollup-plugin-analyzer,但它对我不起作用。
ton*_*y19 58
或者,您可以使用vite-bundle-visualizer,它使用rollup-plugin-visualizer:
npx vite-bundle-visualizer
Run Code Online (Sandbox Code Playgroud)
# In your vite project's root
$ npx vite-bundle-visualizer
# Then open stats.html in browser
Run Code Online (Sandbox Code Playgroud)
$ npx vite-bundle-visualizer --help
vite-bundle-visualizer
Usage:
$ vite-bundle-visualizer <command> [options]
Options:
--template -t <template> Template to use, options are "raw-data" (JSON), "treemap", "list" (YAML), "sunburst" and "network" (default: treemap)
--output -o <filepath> Output file path, should be "**/*.html" or "**/*.json" (default: /Users/kuss/project/sides/oss/vite-bundle-visualizer/stats.html)
--open <open> Should open browser after generated, except when template is "json" (default: true)
-h, --help Display this message
Run Code Online (Sandbox Code Playgroud)
$ npx vite-bundle-visualizer
Run Code Online (Sandbox Code Playgroud)

$ npx vite-bundle-visualizer -t sunburst
Run Code Online (Sandbox Code Playgroud)

$ npx vite-bundle-visualizer -t network
Run Code Online (Sandbox Code Playgroud)

输出统计的原始数据(JSON)
# @deprecated vite-bundle-visualizer -t json
$ npx vite-bundle-visualizer -t raw-data
Run Code Online (Sandbox Code Playgroud)
小智 36
您可以使用rollup-plugin-visualizer;
import { visualizer } from "rollup-plugin-visualizer";
...
export default defineConfig({
...
plugins: [
...
visualizer({
template: "treemap", // or sunburst
open: true,
gzipSize: true,
brotliSize: true,
filename: "analyse.html", // will be saved in project's root
}) as PluginOption,
...
],
...
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22362 次 |
| 最近记录: |