@zohodesk/react-cli 1.1.14-exp.1 → 1.1.14-exp.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +0 -13
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +29 -13
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
@@ -44,19 +44,6 @@ Now to run app
|
|
44
44
|
|
45
45
|
# Change Logs
|
46
46
|
|
47
|
-
# 1.1.14-exp.1 (20-9-2023)
|
48
|
-
|
49
|
-
**Feature:-**
|
50
|
-
|
51
|
-
- externals was added to Prevent bundling of certain imported packages and instead retrieve these external dependencies at runtime.
|
52
|
-
- to use externals, we use the following pattern in `app > externals` :
|
53
|
-
|
54
|
-
For example
|
55
|
-
```
|
56
|
-
externals: {
|
57
|
-
<key> : <value>
|
58
|
-
}
|
59
|
-
```
|
60
47
|
# 1.1.14 (11-9-2023)
|
61
48
|
|
62
49
|
**Feature:-**
|
@@ -184,15 +184,15 @@ class I18nDownlodLogic {
|
|
184
184
|
|
185
185
|
const buf = [];
|
186
186
|
/*
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
187
|
+
if (REGEXP_HASH.test(filenameTemplate)) {
|
188
|
+
buf.push(
|
189
|
+
`var hash = ${mainTemplate.renderCurrentHashCode(hash)};`
|
190
|
+
);
|
191
|
+
}
|
192
|
+
if (REGEXP_CHUNKHASH.test(filenameTemplate)) {
|
193
|
+
buf.push(`var chunkHashes = ${JSON.stringify(chunkMaps.hash)};`);
|
194
|
+
}
|
195
|
+
*/
|
196
196
|
|
197
197
|
if ((0, _hashUtils.hasContentHash)(filenameTemplate)) {
|
198
198
|
const hashLength = getContentHashMaxLength(filenameTemplate);
|
@@ -205,12 +205,18 @@ class I18nDownlodLogic {
|
|
205
205
|
|
206
206
|
const publicPath = this.publicPath ? JSON.stringify(this.publicPath) : `${mainTemplate.requireFn}.p`;
|
207
207
|
return _webpack.Template.asString([source, `
|
208
|
-
|
208
|
+
function downloadScriptTagForI18nDynamicChunks(chunkName = '', language = '') {
|
209
209
|
// ${pluginName} I18N loading
|
210
210
|
var i18nChunks = ${JSON.stringify(chunkMap)};
|
211
211
|
var locale = ${localeVarName};
|
212
212
|
// ${pluginName} I18N hasehes
|
213
213
|
${hashUtils}
|
214
|
+
if(chunkName) {
|
215
|
+
chunkId = chunkName;
|
216
|
+
}
|
217
|
+
if (language) {
|
218
|
+
locale = language;
|
219
|
+
}
|
214
220
|
if(installedI18nChunks[chunkId]) {
|
215
221
|
promises.push(installedI18nChunks[chunkId]);
|
216
222
|
} else if(installedI18nChunks[chunkId] !== 0 && i18nChunks[chunkId]) {
|
@@ -245,10 +251,19 @@ class I18nDownlodLogic {
|
|
245
251
|
}` : ''}
|
246
252
|
document.body.appendChild(scriptTag);
|
247
253
|
}).then(function() {
|
248
|
-
installedI18nChunks[chunkId] = 0;
|
254
|
+
installedI18nChunks[chunkId] = 0;
|
249
255
|
}));
|
250
256
|
}
|
251
|
-
}
|
257
|
+
};
|
258
|
+
downloadScriptTagForI18nDynamicChunks();
|
259
|
+
${mainTemplate.requireFn}.changeLanguage = function changeLanguage(language) {
|
260
|
+
window.userLangCode=language;
|
261
|
+
Object.keys(installedI18nChunks).map(chunks => {
|
262
|
+
if (chunks !== './runtime~main' && installedI18nChunks[chunks] == 0) {
|
263
|
+
installedI18nChunks[chunks] = null;
|
264
|
+
downloadScriptTagForI18nDynamicChunks(chunks, language);
|
265
|
+
}
|
266
|
+
});}`]);
|
252
267
|
});
|
253
268
|
}
|
254
269
|
|
@@ -256,7 +271,8 @@ class I18nDownlodLogic {
|
|
256
271
|
compiler.hooks.thisCompilation.tap(pluginName, compilation => {
|
257
272
|
const {
|
258
273
|
mainTemplate
|
259
|
-
} = compilation;
|
274
|
+
} = compilation; // this.createChangeLanguageFunction(mainTemplate);
|
275
|
+
|
260
276
|
this.addDownloadLogicOfI18nInMainTemplate(mainTemplate);
|
261
277
|
});
|
262
278
|
}
|
package/npm-shrinkwrap.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zohodesk/react-cli",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.10",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "@zohodesk/react-cli",
|
9
|
-
"version": "1.1.
|
9
|
+
"version": "1.1.10",
|
10
10
|
"license": "ISC",
|
11
11
|
"dependencies": {
|
12
12
|
"@babel/cli": "7.10.5",
|