"null" 区域在我的 React 项目的 source-map-explorer 可视化中对应什么,为什么这么大?
What does the "null" area correspond to in the source-map-explorer visualisation for my React project, and why is it so big?
我一直在做一个比较简单的React项目,大概有8个组件,常用的插件也比较少(包括styled-components、react-spring和AWS-Amplify)
我已经安装 运行 source-map-explorer 以查看为什么我的构建超过 3MB,并且生成的可视化显示超过 2MB 我的包被占用上升 'null'.
谁能解释一下 'null' 在这种情况下指的是什么? 我猜这是我的尺寸包,但我无法想象为什么会这么大。
此外,如果有人知道任何关于如何减少 CRA 项目中剩余 1MB 节点模块大小的绝妙资源,那就太棒了!
最终,这是一个 AWS Amplify 问题。我的应用专门使用 API 功能,但我导入了整个库。
在我的代码中,我更改了:
import Amplify from "aws-amplify"
进入
import Amplify from "@aws-amplify/core"
import API from "@aws-amplify/api"
我的包大小从超过 3MB 减少到 679kb。
不确定为什么它在 source-map-explorer 中显示为 'null',但这可能有助于使用 AWS Amplify 并遇到捆绑包大小问题的任何人。我发现有帮助的其他资源:
https://github.com/aws-amplify/amplify-js/wiki/Amplify-modularization
我一直在做一个比较简单的React项目,大概有8个组件,常用的插件也比较少(包括styled-components、react-spring和AWS-Amplify)
我已经安装 运行 source-map-explorer 以查看为什么我的构建超过 3MB,并且生成的可视化显示超过 2MB 我的包被占用上升 'null'.
谁能解释一下 'null' 在这种情况下指的是什么? 我猜这是我的尺寸包,但我无法想象为什么会这么大。
此外,如果有人知道任何关于如何减少 CRA 项目中剩余 1MB 节点模块大小的绝妙资源,那就太棒了!
最终,这是一个 AWS Amplify 问题。我的应用专门使用 API 功能,但我导入了整个库。
在我的代码中,我更改了:
import Amplify from "aws-amplify"
进入
import Amplify from "@aws-amplify/core"
import API from "@aws-amplify/api"
我的包大小从超过 3MB 减少到 679kb。
不确定为什么它在 source-map-explorer 中显示为 'null',但这可能有助于使用 AWS Amplify 并遇到捆绑包大小问题的任何人。我发现有帮助的其他资源:
https://github.com/aws-amplify/amplify-js/wiki/Amplify-modularization