-
Notifications
You must be signed in to change notification settings - Fork 167
Improve usage of passed along react-intl modules #1982
Comments
Tech Design
|
Discussed with @tbiethman about this issue. We think a better path forward would be to avoid passing react-intl modules through terra-i18n / terra-base and instead manage the version of react-intl through peerDependencies in components that need intl similar to how we manage the version of react that components use. With this, each package that needs modules from react-intl would import directly from react-intl and set a peerDependency on react-intl. The react-intl modules that are passed through terra-i18n and terra-base should be removed in a major version bump. |
+1 on peer-dependencies. |
|
Feature Request
Description
We've started exposing react-intl modules from terra-base. One of the issues with this is related to how we expose the react-intl modules. We import modules from react intl and then export them from this file. This is then consumed like so:
import { injectIntl, intlShape } from 'terra-base';
.This pulls in and executes more code than just
injectIntl
andintlShape
, but it's not immediately obivous. This executes this file, which executes this line, which exectus this file from terra-i18n which executes our i18n logic.If we want to continue exporting react-intl modules from terra-base, we should look at ways to do this that don't require the full terra-base and terra-i18n files to execute when importing the react-intl modules.
Additional Context / Screenshots
Consumers noticed this issue in a recent release of terra-application-header-layout where we added this line
import { injectIntl, intlShape } from 'terra-base';
.The text was updated successfully, but these errors were encountered: