如何确定为什么要在 Rollup 块中导入某些内容?

问题描述 投票:0回答:0

题目内容是我在分析为什么我的bundle里面有很多没用到的代码

在屏幕截图中,我看到正在加载一个名为 chunk-index.es.fbfa066e.js 的块。加载应用程序后,76% 的代码未被使用。

如果我查看这个模块的contents,它基本上捆绑了 3 个其他包。

// @preserve module @/node_modules/.pnpm/[email protected]/node_modules/is-plain-object/dist/is-plain-object.mjs
// @preserve module @/node_modules/.pnpm/[email protected]/node_modules/immer/dist/immer.esm.mjs
// @preserve module @/node_modules/.pnpm/[email protected]/node_modules/slate/dist/index.es.js

ane 将它们导出为

export {
  Element as E,
  Node as N,
  Operation as O,
  Path as P,
  Range as R,
  Scrubber as S,
  Transforms as T,
  Editor as a,
  Text as b,
  Point as c,
  createEditor as d,
  isPlainObject as i
};

现在如果我看发起的projects.page.client.f6019eee.js

但是,在 projects.page.client 中对这个模块的唯一引用是这个 import:

import "../../../chunk-Table.31bce020.js";
import "../../../chunk-index.es.fbfa066e.js";
import "../../../chunk-Tabs.0cbe576c.js";

即它甚至不导入任何命名的导出。

  • 为什么 chunk-index.es.fbfa066e.js import 包含在 projects.page.client.f6019eee.js 中? (以及如何调试它?)
  • 如果不进口出口产品,projects.page.client.f6019eee.js如何使用它?
  • 我如何告诉 不要导入这个块?
javascript performance rollupjs
© www.soinside.com 2019 - 2024. All rights reserved.