使用 Tree Shake 图标构建 Flutter Web

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

当我使用命令

--tree-shake-icons
将 flutter 构建到 Web 平台时,我收到此错误。

This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following locations:

file:///Users/xxx/Documents/flutter/packages/flutter/lib/src/widgets/icon_data.dart:22:9

file:///Users/xxx/Documents/hxgy/flutter/projectName/lib/utils/font_util/font_utils.dart:13:7
Target web_-release_bundle failed: Exception: Avoid non-constant invocations of IconData or try to build again with
--no-tree-shake-icons.

我需要flutter自动压缩字体图标的大小,因为图标太大,所以我没有使用

--no-tree-shake-icons
指挥官。

flutter flutter-web flutter-build
2个回答
3
投票

Flutter Web 尚不支持

--tree-shake-icons
可能有帮助。


0
投票
© www.soinside.com 2019 - 2024. All rights reserved.