You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
На версиях Prizm 4+ для Angular 17 после релиза нового сета иконок и внедрения их в компоненты у части проектов возникли проблемы с увеличенным размером сборки и сложности с CI, т.к. из-за поддержки ленивой загрузки иконок в компонентах в любую сборку попадало два полных пака иконок (base и full - порядка 2mb).
Краткое описание решения и его обоснование
Решение предполагает полный отказ от ленивой загрузки иконок внутри компонентов Prizm. Иконки должны регистрироваться таргетно и исключительно те, которые используются в компоненте статически.
Управление остальными иконками для достижения большей гибкости передается на сторону проектов.
Варианты решения на стороне проектов:
Чтобы сохранить существующее поведение необходимо добавить в проект провайдеры для ленивой загрузки, например, на уровне app.module (для каждого пака свой). В этом случае все иконки из пака попадут в сборку, но регистрировать каждую отдельную иконку не нужно, это быстрое и простое решение. Хорошо подойдет проектам, где названия иконок неизвестны заранее (приходят с сервера, иконки выбирает пользователь и т.п.
`
import { prizmIconsProvideLazyLoader } from '@prizm-ui/icons-loader';
import { prizmIconsFullProvideLazyLoader } from '@prizm-ui/icons-loader/full';
//
providers: [
/**
* use our loader for the get the full icons without having to register
* /
prizmIconsFullProvideLazyLoader(),
/*
* use our loader for the get the icons without having to register
* */
prizmIconsProvideLazyLoader(),
],/
`
Зарегистрировать все использующиеся иконки в проекте в соответствующие registry (для каждого пака - base и full - свой). Иконки можно регистрировать как на месте использования, так и в одном месте глобально на весь проект. Это решение немного сложнее, но при таком подходе в сборку попадут только те иконки, которые нужны. Это будет удобно для проектов с малым количеством иконок и там, где необходимо контролировать размер проекта.
Последствия
Команды получают гибкость в управлении иконками
Возможность уменьшить размер сборки там, где это важно и необходимо
Для сохранения поведения потребуются минимальные изменения со стороны проектов
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Мотив
На версиях Prizm 4+ для Angular 17 после релиза нового сета иконок и внедрения их в компоненты у части проектов возникли проблемы с увеличенным размером сборки и сложности с CI, т.к. из-за поддержки ленивой загрузки иконок в компонентах в любую сборку попадало два полных пака иконок (base и full - порядка 2mb).
Краткое описание решения и его обоснование
Решение предполагает полный отказ от ленивой загрузки иконок внутри компонентов Prizm. Иконки должны регистрироваться таргетно и исключительно те, которые используются в компоненте статически.
Управление остальными иконками для достижения большей гибкости передается на сторону проектов.
Варианты решения на стороне проектов:
`
import { prizmIconsProvideLazyLoader } from '@prizm-ui/icons-loader';
import { prizmIconsFullProvideLazyLoader } from '@prizm-ui/icons-loader/full';
//
providers: [
/**
* use our loader for the get the full icons without having to register
* /
prizmIconsFullProvideLazyLoader(),
/*
* use our loader for the get the icons without having to register
* */
prizmIconsProvideLazyLoader(),
],/
`
Последствия
Команды получают гибкость в управлении иконками
Возможность уменьшить размер сборки там, где это важно и необходимо
Beta Was this translation helpful? Give feedback.
All reactions