代码之家  ›  专栏  ›  技术社区  ›  Bear Bile Farming is Torture

React包大小增加的幅度超过了它所包含的文件

  •  1
  • Bear Bile Farming is Torture  · 技术社区  · 1 年前
    require(`./path/to/large_file`)
    

    如果不需要这个文件,React应用程序构建包的大小为36 MB。

    包含此文件后,结果为80 MB。

    然而文件本身的大小, ./path/to/large_file ,只有21MB,通过这个linux命令:

    du -sh ./path/to/large_file
    

    21 + 36 = 57

    80 - 57 = 23

    有人能解释一下捆绑包中额外23 MB大小的原因吗?

    1 回复  |  直到 1 年前
        1
  •  1
  •   Jonas Wilms    1 年前

    可能是文件本身 require(…) s进一步的依赖关系,现在需要解决并将其包含在捆绑包中。

    推荐文章