Skip to content

Commit adc7fe9

Browse files
prabhjot-msftcarocao-msft
authored andcommitted
Treeshaking Locales and Reduced Bundle Size (#3615)
* Treeshake locales * Treeshake locales from composites * minor * Change files * Duplicate change files for beta release * minor changes
1 parent cfcd43b commit adc7fe9

51 files changed

Lines changed: 720 additions & 386 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "improvement",
4+
"workstream": "Calling",
5+
"comment": "Treeshake locales from composites",
6+
"packageName": "@azure/communication-react",
7+
"email": "97124699+prabhjot-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "improvement",
4+
"workstream": "Calling",
5+
"comment": "Treeshake locales from composites",
6+
"packageName": "@azure/communication-react",
7+
"email": "97124699+prabhjot-msft@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}

common/config/webpack/sampleapp.webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const webpackConfig = (sampleAppDir, env, babelConfig) => {
6868
__BUILDTIME__: JSON.stringify(new Date().toLocaleString())
6969
}),
7070
new BundleAnalyzerPlugin({
71-
analyzerMode: 'json',
71+
analyzerMode: 'json'
7272
}),
7373
new CopyPlugin({
7474
patterns: [

packages/communication-react/src/index.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,27 @@ export {
131131
StreamMedia,
132132
TypingIndicator,
133133
VideoGallery,
134-
VideoTile
134+
VideoTile,
135+
COMPONENT_LOCALE_EN_GB,
136+
COMPONENT_LOCALE_AR_SA,
137+
COMPONENT_LOCALE_CS_CZ,
138+
COMPONENT_LOCALE_DE_DE,
139+
COMPONENT_LOCALE_ES_ES,
140+
COMPONENT_LOCALE_FI_FI,
141+
COMPONENT_LOCALE_FR_FR,
142+
COMPONENT_LOCALE_HE_IL,
143+
COMPONENT_LOCALE_IT_IT,
144+
COMPONENT_LOCALE_JA_JP,
145+
COMPONENT_LOCALE_KO_KR,
146+
COMPONENT_LOCALE_NB_NO,
147+
COMPONENT_LOCALE_NL_NL,
148+
COMPONENT_LOCALE_PL_PL,
149+
COMPONENT_LOCALE_PT_BR,
150+
COMPONENT_LOCALE_RU_RU,
151+
COMPONENT_LOCALE_SV_SE,
152+
COMPONENT_LOCALE_TR_TR,
153+
COMPONENT_LOCALE_ZH_CN,
154+
COMPONENT_LOCALE_ZH_TW
135155
} from '../../react-components/src';
136156
/* @conditional-compile-remove(image-gallery) */
137157
export { ImageGallery } from '../../react-components/src';

packages/react-components/src/index.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@ export { _IdentifierProvider } from './identifiers';
66
export type { _Identifiers, _IdentifierProviderProps } from './identifiers';
77
export * from './localization/locales';
88
export { LocalizationProvider } from './localization';
9+
export { COMPONENT_LOCALE_EN_GB } from './localization/locales/en-GB/ComponentLocale';
10+
export { COMPONENT_LOCALE_AR_SA } from './localization/locales/ar-SA/ComponentLocale';
11+
export { COMPONENT_LOCALE_CS_CZ } from './localization/locales/cs-CZ/ComponentLocale';
12+
export { COMPONENT_LOCALE_DE_DE } from './localization/locales/de-DE/ComponentLocale';
13+
export { COMPONENT_LOCALE_ES_ES } from './localization/locales/es-ES/ComponentLocale';
14+
export { COMPONENT_LOCALE_FI_FI } from './localization/locales/fi-FI/ComponentLocale';
15+
export { COMPONENT_LOCALE_FR_FR } from './localization/locales/fr-FR/ComponentLocale';
16+
export { COMPONENT_LOCALE_HE_IL } from './localization/locales/he-IL/ComponentLocale';
17+
export { COMPONENT_LOCALE_IT_IT } from './localization/locales/it-IT/ComponentLocale';
18+
export { COMPONENT_LOCALE_JA_JP } from './localization/locales/ja-JP/ComponentLocale';
19+
export { COMPONENT_LOCALE_KO_KR } from './localization/locales/ko-KR/ComponentLocale';
20+
export { COMPONENT_LOCALE_NB_NO } from './localization/locales/nb-NO/ComponentLocale';
21+
export { COMPONENT_LOCALE_NL_NL } from './localization/locales/nl-NL/ComponentLocale';
22+
export { COMPONENT_LOCALE_PL_PL } from './localization/locales/pl-PL/ComponentLocale';
23+
export { COMPONENT_LOCALE_PT_BR } from './localization/locales/pt-BR/ComponentLocale';
24+
export { COMPONENT_LOCALE_RU_RU } from './localization/locales/ru-RU/ComponentLocale';
25+
export { COMPONENT_LOCALE_SV_SE } from './localization/locales/sv-SE/ComponentLocale';
26+
export { COMPONENT_LOCALE_TR_TR } from './localization/locales/tr-TR/ComponentLocale';
27+
export { COMPONENT_LOCALE_ZH_CN } from './localization/locales/zh-CN/ComponentLocale';
28+
export { COMPONENT_LOCALE_ZH_TW } from './localization/locales/zh-TW/ComponentLocale';
929
export type { ComponentStrings, ComponentLocale, LocalizationProviderProps } from './localization';
1030
export * from './theming';
1131

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
import { createComponentStrings } from '../utils';
5+
import type { ComponentLocale } from '../..';
6+
import ar_SA from './strings.json';
7+
8+
/**
9+
* Locale for Arabic (Saudi Arabia).
10+
*
11+
* @public
12+
*/
13+
export const COMPONENT_LOCALE_AR_SA: ComponentLocale = { strings: createComponentStrings(ar_SA) };
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
import { createComponentStrings } from '../utils';
5+
import type { ComponentLocale } from '../..';
6+
import cs_CZ from './strings.json';
7+
8+
/**
9+
* Locale for Czech (Czech Republic).
10+
*
11+
* @public
12+
*/
13+
export const COMPONENT_LOCALE_CS_CZ: ComponentLocale = { strings: createComponentStrings(cs_CZ) };
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
import { createComponentStrings } from '../utils';
5+
import type { ComponentLocale } from '../..';
6+
import de_DE from './strings.json';
7+
8+
/**
9+
* Locale for German (Germany).
10+
*
11+
* @public
12+
*/
13+
export const COMPONENT_LOCALE_DE_DE: ComponentLocale = { strings: createComponentStrings(de_DE) };
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
import { createComponentStrings } from '../utils';
5+
import type { ComponentLocale } from '../..';
6+
import en_GB from './strings.json';
7+
8+
/**
9+
* Locale for English (GB).
10+
*
11+
* @public
12+
*/
13+
export const COMPONENT_LOCALE_EN_GB: ComponentLocale = { strings: createComponentStrings(en_GB) };
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
import { createComponentStrings } from '../utils';
5+
import type { ComponentLocale } from '../..';
6+
import es_ES from './strings.json';
7+
8+
/**
9+
* Locale for Spanish (Spain).
10+
*
11+
* @public
12+
*/
13+
export const COMPONENT_LOCALE_ES_ES: ComponentLocale = { strings: createComponentStrings(es_ES) };

0 commit comments

Comments
 (0)