@zohodesk/client_build_tool 0.0.16-exp.7 → 0.0.16-exp.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -0
- package/README_backup.md +169 -0
- package/lib/schemas/defaultConfigValues.js +4 -4
- package/lib/shared/babel/babelWebConfig.js +1 -1
- package/lib/shared/babel/getBabelPlugin.js +13 -3
- package/lib/shared/babel/runBabelForTsFile.js +15 -1
- package/lib/shared/bundler/webpack/custom_plugins/ChunkHierarchyPlugin.js +44 -54
- package/lib/shared/bundler/webpack/custom_plugins/ResourceHintsPlugin.js +36 -39
- package/lib/shared/bundler/webpack/pluginConfigs/configResourceHintsPlugin.js +4 -8
- package/lib/shared/bundler/webpack/plugins.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -463,6 +463,175 @@ For example
|
|
|
463
463
|
- `customAttributes` support for add attributes to html, link , script tag in the output build.
|
|
464
464
|
|
|
465
465
|
|
|
466
|
+
## v0.0.1 (18-04-2023)
|
|
467
|
+
|
|
468
|
+
First Release
|
|
469
|
+
**Features:-**
|
|
470
|
+
|
|
471
|
+
- 'start' command to run react app
|
|
472
|
+
- 'build' command to create build for react app
|
|
473
|
+
- 'build:lib' command to create lib for react library
|
|
474
|
+
- 'build:es' command to create es for react library
|
|
475
|
+
- 'templates' command to create es for react library
|
|
476
|
+
# Changelog and Release Notes
|
|
477
|
+
|
|
478
|
+
# v0.0.16 (05-11-2025)
|
|
479
|
+
|
|
480
|
+
**Adjustments:-**
|
|
481
|
+
- ChunkHierarchyPlugin.js – Added support for ConcatenatedModule modules.
|
|
482
|
+
- InjectChunkGraphPlugin.js – Changed the template name from {{--preload-chunk-graph-object}} to __PRELOAD_CHUNK_GRAPH__ to resolve minification issues.
|
|
483
|
+
- Disabled CSS source map generation – CSS source maps were being created when RTL split was disabled and sourceMap was enabled, causing issues. Hence, CSS source map creation has been disabled
|
|
484
|
+
- Source map path correction – The resolving paths in source map files appeared as zohodesk-react/./src, which was incompatible with the Murphy tool. Updated it to zohodesk-react/src by adding a function to devtoolModuleFilenameTemplate in the output configuration.
|
|
485
|
+
- ChunkHierarchyPlugin – Made it active in development mode as well by removing the “run only in production” condition.
|
|
486
|
+
|
|
487
|
+
# v0.0.15 (11-10-2025)
|
|
488
|
+
|
|
489
|
+
**Feature:-**
|
|
490
|
+
- Chunk Dependency Mapping: Added a new feature that generates a JSON file listing all chunk dependencies in the Webpack build
|
|
491
|
+
For example, if main.js is a chunk, the generated JSON will include all of its direct imports (dependencies).
|
|
492
|
+
- Purpose:
|
|
493
|
+
To provide clear visibility into chunk relationships and dependencies for debugging, optimization, and performance analysis.
|
|
494
|
+
|
|
495
|
+
```
|
|
496
|
+
chunkGraph:{
|
|
497
|
+
enable: { value: true },
|
|
498
|
+
fileName: ''
|
|
499
|
+
}
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
- Preload Chunk Split Visualization
|
|
503
|
+
Enhanced the Preload Chunk (PLC) mechanism to identify and list the sub-chunks generated from a preloaded parent chunk.
|
|
504
|
+
When a chunk is configured for preloading (e.g., ticket.js), the system now traces and records all the split chunks associated with it — for example
|
|
505
|
+
|
|
506
|
+
if resourceHints not enabled plc , pfc and custom function related to this are not created
|
|
507
|
+
|
|
508
|
+
```
|
|
509
|
+
resourceHints: {
|
|
510
|
+
enable: true,
|
|
511
|
+
PreloadChunkNames: [//name of chunks to be preload//]
|
|
512
|
+
},
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
# v0.0.14 (06-10-2025)
|
|
517
|
+
|
|
518
|
+
**Feature:-**
|
|
519
|
+
- Added integrity and crossorigin attributes for all the js and css files in index.html
|
|
520
|
+
|
|
521
|
+
```enableSubResourceIntegrity: true
|
|
522
|
+
```
|
|
523
|
+
**Adjustments:-**
|
|
524
|
+
- add ts-loader to parse tsx and ts files
|
|
525
|
+
|
|
526
|
+
# v0.0.13 (02-09-2025)
|
|
527
|
+
|
|
528
|
+
**Adjustments:-**
|
|
529
|
+
- Source map files are created in the smap/ folder by default. However, they are also being created in the js/ folder to resolve the issue where Murphy was unable to locate them.
|
|
530
|
+
|
|
531
|
+
**Feature:-**
|
|
532
|
+
- Added support for Murphy to be built as a separate chunk and injected as the top script in the initial HTML.
|
|
533
|
+
- To enable this support , add this in your configuration
|
|
534
|
+
|
|
535
|
+
```murphyBootstrapHtml{
|
|
536
|
+
enable: true,
|
|
537
|
+
chunkName: '',
|
|
538
|
+
filePath: ''
|
|
539
|
+
}```
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
# v0.0.12 (14-08-2025)
|
|
544
|
+
|
|
545
|
+
- Fixed the initial i18n loading issue caused by using the same function in both the i18nRuntimeDealer plugin and decidePublicPath
|
|
546
|
+
|
|
547
|
+
# v0.0.11 (07-08-2025) (had an issue while enable i18n chunk split plugin)
|
|
548
|
+
- remove babel-plugin-module-resolver dependencies
|
|
549
|
+
|
|
550
|
+
**Adjustments:-**
|
|
551
|
+
- Public Folder configuration is separated for development and production
|
|
552
|
+
|
|
553
|
+
**Bug Fix:-**
|
|
554
|
+
- Fixed the issue where the build log was not visible when `stats (bundle integrity)` was enabled. The problem was resolved by adding an error check in the `bundleIntegrity plugin`.
|
|
555
|
+
- Removed the babel-plugin-module-resolver dependency to resolve the alias resolution issue in the application.
|
|
556
|
+
- Fixed the issue where a space in the variable name causes it to return an undefined value.
|
|
557
|
+
- Fixed the URL path generation issue that occurred while using context in the development setup.
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
# v0.0.10 (12-05-2025)
|
|
561
|
+
**Feature:-**
|
|
562
|
+
- `alias` support for `build:es` and `build:lib`
|
|
563
|
+
- Add babel-plugin-module-resolver dependencies
|
|
564
|
+
- Modify getBabelPlugin to include module resolver with aliases
|
|
565
|
+
|
|
566
|
+
**Bug Fix:-**
|
|
567
|
+
- Enhance runBabelForTSFile to handle both .tsx and .ts file extensions
|
|
568
|
+
- Update mockApiHandler to ensure mock function is called correctly
|
|
569
|
+
|
|
570
|
+
**Change:-**
|
|
571
|
+
- Refactor defaultConfigValues.js to include cli options for enableRTLSplit
|
|
572
|
+
|
|
573
|
+
## v0.0.9
|
|
574
|
+
|
|
575
|
+
**Feature:-**
|
|
576
|
+
- externals was added to Prevent bundling of certain imported packages and retrieve these external dependencies at runtime.
|
|
577
|
+
- to use externals, we use the following pattern in `app > externals` :
|
|
578
|
+
|
|
579
|
+
For example
|
|
580
|
+
```
|
|
581
|
+
externals: {
|
|
582
|
+
<key> : <value>
|
|
583
|
+
}
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
## v0.0.6 (4-09-2023)
|
|
587
|
+
|
|
588
|
+
**Feature:-**
|
|
589
|
+
- Generating bundle integrity report json file for the build assets only in production mode. To use this feature we need to add `stats > enable` or cli flags `enable_stats`.
|
|
590
|
+
- Added Resource Cleanup plugin to cleanup resource retained by build tool. this plugin is controlled by efc flag resourcecleanup flag.
|
|
591
|
+
- added support for using regex expression to get group of chunks chunkId via Resource Hint plugin prefetch/preload hook.
|
|
592
|
+
only will be activate when `resourceHints` => `allowPrefetchingMultipleChunks` as `true`
|
|
593
|
+
- added support for glob pattern for custom chunks split logic.
|
|
594
|
+
- added options to split chunks base config in the key `app` => `customChunksBaseConfig` as object
|
|
595
|
+
|
|
596
|
+
**Change:-**
|
|
597
|
+
- i18n name not generated issue fix.
|
|
598
|
+
- public path not correctly set issue fix.
|
|
599
|
+
- changing plugin hook stages in i18nRuntimePlugin and sourceMapPlugin
|
|
600
|
+
## v0.0.5 (6-08-2023)
|
|
601
|
+
|
|
602
|
+
**Changes:--**
|
|
603
|
+
- Typo fix in i18nRuntimeDealerPlugin.js
|
|
604
|
+
- fixing some bugs in resolvers.js file
|
|
605
|
+
|
|
606
|
+
## v0.0.3 (1-08-2023)
|
|
607
|
+
|
|
608
|
+
**Changes:--**
|
|
609
|
+
- `devtool` default value changed from `hidden-cheap-source-map` to `source-map`
|
|
610
|
+
- unwanted files deleted from build
|
|
611
|
+
|
|
612
|
+
**Issue Fix:--**
|
|
613
|
+
- The issue with the source map not being created in the build has been fixed."
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
## v0.0.2 (28-04-2023)
|
|
617
|
+
|
|
618
|
+
**Features:-**
|
|
619
|
+
|
|
620
|
+
- `devModeContentHashAllowedTypes` support added for some project there will be a need for hash even though they run dev mode. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#devModeContentHashAllowedTypes)
|
|
621
|
+
- `devLikeHash` support for disable content hash for file names in production mode. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#devLikeHash)
|
|
622
|
+
- `disableReactDevWarning` disable react dev warning such as prop-type warnings will be removed in dev mode build or server. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#disableReactDevWarning) can be enabled via `--disable_react_dev_warning` too.
|
|
623
|
+
- `statsLogConfig` support to customize default webpack log after build finished. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#statsLogConfig) can be enabled via `--disable_react_dev_warning` too.
|
|
624
|
+
- `enableChunkHash` renamed as `enableFileNameHashing`
|
|
625
|
+
|
|
626
|
+
- `pre_processor` command to run the preprocessor.js file.preProcessor runs in build, start, buildEs, buildLib commands bu default. and we have watch mode support as well with the option (`-w`)
|
|
627
|
+
- `createSeparateSmap` flag `source_map_enable` renamed as `enable_smap`
|
|
628
|
+
- `removeAttribute` option changes as `babelCustomizations.removeAttribute`
|
|
629
|
+
- `removePropTypes` support for remove the prop types package in the output build.
|
|
630
|
+
- `devConsoleExclude` support for remove the _console statements_ such as _console.log_, _console.warn_ in the output build.
|
|
631
|
+
- `manifestJson` default value set as false.
|
|
632
|
+
- `customAttributes` support for add attributes to html, link , script tag in the output build.
|
|
633
|
+
|
|
634
|
+
|
|
466
635
|
## v0.0.1 (18-04-2023)
|
|
467
636
|
|
|
468
637
|
First Release
|
package/README_backup.md
CHANGED
|
@@ -294,6 +294,175 @@ For example
|
|
|
294
294
|
- `customAttributes` support for add attributes to html, link , script tag in the output build.
|
|
295
295
|
|
|
296
296
|
|
|
297
|
+
## v0.0.1 (18-04-2023)
|
|
298
|
+
|
|
299
|
+
First Release
|
|
300
|
+
**Features:-**
|
|
301
|
+
|
|
302
|
+
- 'start' command to run react app
|
|
303
|
+
- 'build' command to create build for react app
|
|
304
|
+
- 'build:lib' command to create lib for react library
|
|
305
|
+
- 'build:es' command to create es for react library
|
|
306
|
+
- 'templates' command to create es for react library
|
|
307
|
+
# Changelog and Release Notes
|
|
308
|
+
|
|
309
|
+
# v0.0.16 (05-11-2025)
|
|
310
|
+
|
|
311
|
+
**Adjustments:-**
|
|
312
|
+
- ChunkHierarchyPlugin.js – Added support for ConcatenatedModule modules.
|
|
313
|
+
- InjectChunkGraphPlugin.js – Changed the template name from {{--preload-chunk-graph-object}} to __PRELOAD_CHUNK_GRAPH__ to resolve minification issues.
|
|
314
|
+
- Disabled CSS source map generation – CSS source maps were being created when RTL split was disabled and sourceMap was enabled, causing issues. Hence, CSS source map creation has been disabled
|
|
315
|
+
- Source map path correction – The resolving paths in source map files appeared as zohodesk-react/./src, which was incompatible with the Murphy tool. Updated it to zohodesk-react/src by adding a function to devtoolModuleFilenameTemplate in the output configuration.
|
|
316
|
+
- ChunkHierarchyPlugin – Made it active in development mode as well by removing the “run only in production” condition.
|
|
317
|
+
|
|
318
|
+
# v0.0.15 (11-10-2025)
|
|
319
|
+
|
|
320
|
+
**Feature:-**
|
|
321
|
+
- Chunk Dependency Mapping: Added a new feature that generates a JSON file listing all chunk dependencies in the Webpack build
|
|
322
|
+
For example, if main.js is a chunk, the generated JSON will include all of its direct imports (dependencies).
|
|
323
|
+
- Purpose:
|
|
324
|
+
To provide clear visibility into chunk relationships and dependencies for debugging, optimization, and performance analysis.
|
|
325
|
+
|
|
326
|
+
```
|
|
327
|
+
chunkGraph:{
|
|
328
|
+
enable: { value: true },
|
|
329
|
+
fileName: ''
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
- Preload Chunk Split Visualization
|
|
334
|
+
Enhanced the Preload Chunk (PLC) mechanism to identify and list the sub-chunks generated from a preloaded parent chunk.
|
|
335
|
+
When a chunk is configured for preloading (e.g., ticket.js), the system now traces and records all the split chunks associated with it — for example
|
|
336
|
+
|
|
337
|
+
if resourceHints not enabled plc , pfc and custom function related to this are not created
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
resourceHints: {
|
|
341
|
+
enable: true,
|
|
342
|
+
PreloadChunkNames: [//name of chunks to be preload//]
|
|
343
|
+
},
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
# v0.0.14 (06-10-2025)
|
|
348
|
+
|
|
349
|
+
**Feature:-**
|
|
350
|
+
- Added integrity and crossorigin attributes for all the js and css files in index.html
|
|
351
|
+
|
|
352
|
+
```enableSubResourceIntegrity: true
|
|
353
|
+
```
|
|
354
|
+
**Adjustments:-**
|
|
355
|
+
- add ts-loader to parse tsx and ts files
|
|
356
|
+
|
|
357
|
+
# v0.0.13 (02-09-2025)
|
|
358
|
+
|
|
359
|
+
**Adjustments:-**
|
|
360
|
+
- Source map files are created in the smap/ folder by default. However, they are also being created in the js/ folder to resolve the issue where Murphy was unable to locate them.
|
|
361
|
+
|
|
362
|
+
**Feature:-**
|
|
363
|
+
- Added support for Murphy to be built as a separate chunk and injected as the top script in the initial HTML.
|
|
364
|
+
- To enable this support , add this in your configuration
|
|
365
|
+
|
|
366
|
+
```murphyBootstrapHtml{
|
|
367
|
+
enable: true,
|
|
368
|
+
chunkName: '',
|
|
369
|
+
filePath: ''
|
|
370
|
+
}```
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
# v0.0.12 (14-08-2025)
|
|
375
|
+
|
|
376
|
+
- Fixed the initial i18n loading issue caused by using the same function in both the i18nRuntimeDealer plugin and decidePublicPath
|
|
377
|
+
|
|
378
|
+
# v0.0.11 (07-08-2025) (had an issue while enable i18n chunk split plugin)
|
|
379
|
+
- remove babel-plugin-module-resolver dependencies
|
|
380
|
+
|
|
381
|
+
**Adjustments:-**
|
|
382
|
+
- Public Folder configuration is separated for development and production
|
|
383
|
+
|
|
384
|
+
**Bug Fix:-**
|
|
385
|
+
- Fixed the issue where the build log was not visible when `stats (bundle integrity)` was enabled. The problem was resolved by adding an error check in the `bundleIntegrity plugin`.
|
|
386
|
+
- Removed the babel-plugin-module-resolver dependency to resolve the alias resolution issue in the application.
|
|
387
|
+
- Fixed the issue where a space in the variable name causes it to return an undefined value.
|
|
388
|
+
- Fixed the URL path generation issue that occurred while using context in the development setup.
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
# v0.0.10 (12-05-2025)
|
|
392
|
+
**Feature:-**
|
|
393
|
+
- `alias` support for `build:es` and `build:lib`
|
|
394
|
+
- Add babel-plugin-module-resolver dependencies
|
|
395
|
+
- Modify getBabelPlugin to include module resolver with aliases
|
|
396
|
+
|
|
397
|
+
**Bug Fix:-**
|
|
398
|
+
- Enhance runBabelForTSFile to handle both .tsx and .ts file extensions
|
|
399
|
+
- Update mockApiHandler to ensure mock function is called correctly
|
|
400
|
+
|
|
401
|
+
**Change:-**
|
|
402
|
+
- Refactor defaultConfigValues.js to include cli options for enableRTLSplit
|
|
403
|
+
|
|
404
|
+
## v0.0.9
|
|
405
|
+
|
|
406
|
+
**Feature:-**
|
|
407
|
+
- externals was added to Prevent bundling of certain imported packages and retrieve these external dependencies at runtime.
|
|
408
|
+
- to use externals, we use the following pattern in `app > externals` :
|
|
409
|
+
|
|
410
|
+
For example
|
|
411
|
+
```
|
|
412
|
+
externals: {
|
|
413
|
+
<key> : <value>
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## v0.0.6 (4-09-2023)
|
|
418
|
+
|
|
419
|
+
**Feature:-**
|
|
420
|
+
- Generating bundle integrity report json file for the build assets only in production mode. To use this feature we need to add `stats > enable` or cli flags `enable_stats`.
|
|
421
|
+
- Added Resource Cleanup plugin to cleanup resource retained by build tool. this plugin is controlled by efc flag resourcecleanup flag.
|
|
422
|
+
- added support for using regex expression to get group of chunks chunkId via Resource Hint plugin prefetch/preload hook.
|
|
423
|
+
only will be activate when `resourceHints` => `allowPrefetchingMultipleChunks` as `true`
|
|
424
|
+
- added support for glob pattern for custom chunks split logic.
|
|
425
|
+
- added options to split chunks base config in the key `app` => `customChunksBaseConfig` as object
|
|
426
|
+
|
|
427
|
+
**Change:-**
|
|
428
|
+
- i18n name not generated issue fix.
|
|
429
|
+
- public path not correctly set issue fix.
|
|
430
|
+
- changing plugin hook stages in i18nRuntimePlugin and sourceMapPlugin
|
|
431
|
+
## v0.0.5 (6-08-2023)
|
|
432
|
+
|
|
433
|
+
**Changes:--**
|
|
434
|
+
- Typo fix in i18nRuntimeDealerPlugin.js
|
|
435
|
+
- fixing some bugs in resolvers.js file
|
|
436
|
+
|
|
437
|
+
## v0.0.3 (1-08-2023)
|
|
438
|
+
|
|
439
|
+
**Changes:--**
|
|
440
|
+
- `devtool` default value changed from `hidden-cheap-source-map` to `source-map`
|
|
441
|
+
- unwanted files deleted from build
|
|
442
|
+
|
|
443
|
+
**Issue Fix:--**
|
|
444
|
+
- The issue with the source map not being created in the build has been fixed."
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
## v0.0.2 (28-04-2023)
|
|
448
|
+
|
|
449
|
+
**Features:-**
|
|
450
|
+
|
|
451
|
+
- `devModeContentHashAllowedTypes` support added for some project there will be a need for hash even though they run dev mode. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#devModeContentHashAllowedTypes)
|
|
452
|
+
- `devLikeHash` support for disable content hash for file names in production mode. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#devLikeHash)
|
|
453
|
+
- `disableReactDevWarning` disable react dev warning such as prop-type warnings will be removed in dev mode build or server. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#disableReactDevWarning) can be enabled via `--disable_react_dev_warning` too.
|
|
454
|
+
- `statsLogConfig` support to customize default webpack log after build finished. for details [details](https://zgit.csez.zohocorpin.com/zohodesk/react-cli/-/blob/3.0.0/packages/client_build_tool/ConfigurationDocumentation.md#statsLogConfig) can be enabled via `--disable_react_dev_warning` too.
|
|
455
|
+
- `enableChunkHash` renamed as `enableFileNameHashing`
|
|
456
|
+
|
|
457
|
+
- `pre_processor` command to run the preprocessor.js file.preProcessor runs in build, start, buildEs, buildLib commands bu default. and we have watch mode support as well with the option (`-w`)
|
|
458
|
+
- `createSeparateSmap` flag `source_map_enable` renamed as `enable_smap`
|
|
459
|
+
- `removeAttribute` option changes as `babelCustomizations.removeAttribute`
|
|
460
|
+
- `removePropTypes` support for remove the prop types package in the output build.
|
|
461
|
+
- `devConsoleExclude` support for remove the _console statements_ such as _console.log_, _console.warn_ in the output build.
|
|
462
|
+
- `manifestJson` default value set as false.
|
|
463
|
+
- `customAttributes` support for add attributes to html, link , script tag in the output build.
|
|
464
|
+
|
|
465
|
+
|
|
297
466
|
## v0.0.1 (18-04-2023)
|
|
298
467
|
|
|
299
468
|
First Release
|
|
@@ -7,14 +7,15 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _os = require("os");
|
|
9
9
|
|
|
10
|
-
var _webpack = require("webpack");
|
|
11
|
-
|
|
12
10
|
// NOTE: Don't use 'config_file' as cli option it was reserved
|
|
13
11
|
var _default = {
|
|
14
12
|
context: {
|
|
15
13
|
value: 'app',
|
|
16
14
|
cli: 'context'
|
|
17
15
|
},
|
|
16
|
+
library: {
|
|
17
|
+
ignorePatterns: []
|
|
18
|
+
},
|
|
18
19
|
devtool: 'source-map',
|
|
19
20
|
statsLogConfig: null,
|
|
20
21
|
stats: {
|
|
@@ -302,8 +303,7 @@ var _default = {
|
|
|
302
303
|
},
|
|
303
304
|
customLoaders: [],
|
|
304
305
|
resourceHints: {
|
|
305
|
-
|
|
306
|
-
PreloadChunkNames: []
|
|
306
|
+
allowPrefetchingMultipleChunks: false
|
|
307
307
|
},
|
|
308
308
|
devModeContentHashAllowedTypes: null,
|
|
309
309
|
nameTemplateCustomization: null,
|
|
@@ -30,7 +30,7 @@ function babelWebConfig(options, mode) {
|
|
|
30
30
|
} = options.typeScript;
|
|
31
31
|
return {
|
|
32
32
|
presets: typeScriptEnable ? [getBabelPresetEnvConfig(browserList, mode), require.resolve('@babel/preset-react'), require.resolve('@babel/preset-typescript')] : [getBabelPresetEnvConfig(browserList, mode), require.resolve('@babel/preset-react')],
|
|
33
|
-
plugins: customBabelPlugins(babelPlugins).concat((0, _getBabelPlugin.getBabelPlugin)(options)).filter(Boolean)
|
|
33
|
+
plugins: customBabelPlugins(babelPlugins).concat((0, _getBabelPlugin.getBabelPlugin)(options, mode)).filter(Boolean)
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -16,12 +16,22 @@ const babelPluginMapping = {
|
|
|
16
16
|
};
|
|
17
17
|
const babelPluginOrder = ['removeAttribute', 'removePropTypes', 'devConsoleExclude'];
|
|
18
18
|
|
|
19
|
-
function getBabelPlugin(options) {
|
|
19
|
+
function getBabelPlugin(options, command) {
|
|
20
20
|
const {
|
|
21
21
|
mode
|
|
22
|
-
} = options;
|
|
23
|
-
|
|
22
|
+
} = options;
|
|
23
|
+
const {
|
|
24
|
+
alias
|
|
25
|
+
} = options.resolve;
|
|
24
26
|
let customPlugins = [];
|
|
27
|
+
|
|
28
|
+
if (command == 'es' || command == 'lib') {
|
|
29
|
+
customPlugins = [[require.resolve('babel-plugin-module-resolver'), {
|
|
30
|
+
root: ['./'],
|
|
31
|
+
alias
|
|
32
|
+
}]];
|
|
33
|
+
}
|
|
34
|
+
|
|
25
35
|
const {
|
|
26
36
|
babelCustomizations
|
|
27
37
|
} = options;
|
|
@@ -11,18 +11,32 @@ var _babelWebConfig = require("./babelWebConfig");
|
|
|
11
11
|
|
|
12
12
|
var _copyFile = require("../fileUtils/copyFile");
|
|
13
13
|
|
|
14
|
+
var _fs = require("fs");
|
|
15
|
+
|
|
14
16
|
function runBabelForTSFile({
|
|
15
17
|
filename,
|
|
16
18
|
outputFile,
|
|
17
19
|
options,
|
|
18
20
|
mode = 'es'
|
|
19
21
|
}) {
|
|
22
|
+
const {
|
|
23
|
+
ignorePatterns
|
|
24
|
+
} = options.library;
|
|
20
25
|
const {
|
|
21
26
|
enable
|
|
22
27
|
} = options.typeScript;
|
|
23
28
|
|
|
24
29
|
if (enable) {
|
|
25
|
-
|
|
30
|
+
function shouldIgnore(filename) {
|
|
31
|
+
return ignorePatterns.some(pattern => pattern.test(filename));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (shouldIgnore(filename)) {
|
|
35
|
+
const jsSourceCode = (0, _fs.readFileSync)(filename).toString();
|
|
36
|
+
(0, _copyFile.writeFile)(outputFile, jsSourceCode);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
26
40
|
const babelConfig = (0, _babelWebConfig.babelWebConfig)(options, mode);
|
|
27
41
|
const result = (0, _core.transformFileSync)(filename, babelConfig);
|
|
28
42
|
(0, _copyFile.writeFile)(outputFile.replace('.tsx', '.js').replace('.ts', '.js'), result.code);
|
|
@@ -1,78 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
// plugins/ChunkHierarchyPlugin.js
|
|
4
|
-
const fs = require(
|
|
4
|
+
const fs = require('fs');
|
|
5
5
|
|
|
6
|
-
const path = require(
|
|
6
|
+
const path = require('path');
|
|
7
7
|
|
|
8
8
|
class ChunkHierarchyPlugin {
|
|
9
|
-
constructor(
|
|
10
|
-
this.
|
|
9
|
+
constructor(outputFile) {
|
|
10
|
+
this.outputFile = outputFile || 'chunk-hierarchy-report.json';
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
apply(compiler) {
|
|
14
|
-
compiler.hooks.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
chunkGraph,
|
|
18
|
-
moduleGraph
|
|
19
|
-
} = compilation;
|
|
20
|
-
const hierarchy = {};
|
|
14
|
+
compiler.hooks.emit.tapAsync('ChunkHierarchyPlugin', (compilation, callback) => {
|
|
15
|
+
const result = {};
|
|
16
|
+
const rootContext = path.resolve(compiler.context, '..', '..');
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
18
|
+
for (const chunk of compilation.chunks) {
|
|
19
|
+
const chunkName = chunk.name || chunk.id;
|
|
20
|
+
const modules = [];
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
for (const module of compilation.chunkGraph.getChunkModulesIterable(chunk)) {
|
|
23
|
+
// Recursively extract real modules (handle ConcatenatedModules)
|
|
24
|
+
collectModules(module, modules, rootContext);
|
|
25
|
+
}
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (!conn.module) continue;
|
|
35
|
-
const mod = conn.module;
|
|
27
|
+
result[chunkName] = modules;
|
|
28
|
+
}
|
|
36
29
|
|
|
37
|
-
|
|
30
|
+
const json = JSON.stringify(result, null, 2);
|
|
31
|
+
const outputPath = compiler.outputPath;
|
|
32
|
+
const outputFile = path.join(outputPath, this.outputFile);
|
|
33
|
+
fs.mkdirSync(outputPath, {
|
|
34
|
+
recursive: true
|
|
35
|
+
});
|
|
36
|
+
fs.writeFileSync(outputFile, json, 'utf-8');
|
|
37
|
+
callback();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
for (const inner of mod.modules) {
|
|
41
|
-
if (inner.resource) {
|
|
42
|
-
const match = inner.resource.match(/(?<!node_modules\/)jsapps\/.*/);
|
|
41
|
+
}
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const match = identifier && identifier.match(/(?<!node_modules\/)jsapps\/.*/);
|
|
43
|
+
function collectModules(module, modules, context) {
|
|
44
|
+
// Handle normal modules
|
|
45
|
+
if (module.resource) {
|
|
46
|
+
console.log(module.resource);
|
|
47
|
+
modules.push(path.relative(context, module.resource));
|
|
48
|
+
return;
|
|
49
|
+
} // Handle ConcatenatedModule (webpack internal)
|
|
52
50
|
|
|
53
|
-
if (match && /^(?!.*node_modules).*$/.test(match)) {
|
|
54
|
-
deps.add(match[0]);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
if (module.modules) {
|
|
53
|
+
for (const innerModule of module.modules) {
|
|
54
|
+
collectModules(innerModule, modules, context);
|
|
55
|
+
}
|
|
56
|
+
} // Handle Webpack 5 internal API (ConcatenatedModule inside _orderedConcatenationList)
|
|
62
57
|
|
|
63
|
-
const outputPath = compiler.options.output.path;
|
|
64
|
-
const outputFile = path.join(outputPath, this.outputFileName); // Ensure folder exists before writing
|
|
65
58
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
} catch (err) {
|
|
71
|
-
console.error("❌ ChunkHierarchyPlugin failed:", err);
|
|
59
|
+
if (module._orderedConcatenationList) {
|
|
60
|
+
for (const item of module._orderedConcatenationList) {
|
|
61
|
+
if (item.module) {
|
|
62
|
+
collectModules(item.module, modules, context);
|
|
72
63
|
}
|
|
73
|
-
}
|
|
64
|
+
}
|
|
74
65
|
}
|
|
75
|
-
|
|
76
66
|
}
|
|
77
67
|
|
|
78
68
|
module.exports = ChunkHierarchyPlugin;
|
|
@@ -22,8 +22,11 @@ const pluginName = 'prefetch-preload-chunk-plugin';
|
|
|
22
22
|
|
|
23
23
|
class ResourceHintsPlugin {
|
|
24
24
|
constructor({
|
|
25
|
-
publicPath
|
|
25
|
+
publicPath,
|
|
26
|
+
resourceHints
|
|
26
27
|
}) {
|
|
28
|
+
this.resourceHints = resourceHints;
|
|
29
|
+
this.allowPrefetchingMultipleChunks = resourceHints.allowPrefetchingMultipleChunks;
|
|
27
30
|
this.publicPathsTemplateObj = {
|
|
28
31
|
js: publicPath,
|
|
29
32
|
css: publicPath,
|
|
@@ -50,6 +53,7 @@ class ResourceHintsPlugin {
|
|
|
50
53
|
compilation.addRuntimeModule(entryRuntimeChunk, // eslint-disable-next-line no-use-before-define
|
|
51
54
|
new ResourceHintsRuntimePlugin(compiler, {
|
|
52
55
|
chunk: entryRuntimeChunk,
|
|
56
|
+
allowPrefetchingMultipleChunks: this.allowPrefetchingMultipleChunks,
|
|
53
57
|
publicPathsTemplateObj
|
|
54
58
|
}));
|
|
55
59
|
};
|
|
@@ -65,11 +69,13 @@ exports.default = ResourceHintsPlugin;
|
|
|
65
69
|
class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
|
|
66
70
|
constructor(compiler, {
|
|
67
71
|
chunk,
|
|
68
|
-
publicPathsTemplateObj
|
|
72
|
+
publicPathsTemplateObj,
|
|
73
|
+
allowPrefetchingMultipleChunks
|
|
69
74
|
}) {
|
|
70
75
|
super('ResourceHintsRuntimePlugin loading', 10);
|
|
71
76
|
this.compiler = compiler;
|
|
72
77
|
this.publicPathsTemplateObj = publicPathsTemplateObj;
|
|
78
|
+
this.allowPrefetchingMultipleChunks = allowPrefetchingMultipleChunks;
|
|
73
79
|
this.chunk = chunk;
|
|
74
80
|
}
|
|
75
81
|
|
|
@@ -79,7 +85,7 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
|
|
|
79
85
|
} = this;
|
|
80
86
|
const idNameMap = chunk.getChunkMaps().name;
|
|
81
87
|
const nameIdMap = {};
|
|
82
|
-
let needsMap =
|
|
88
|
+
let needsMap = this.allowPrefetchingMultipleChunks;
|
|
83
89
|
Object.keys(idNameMap).forEach(key => {
|
|
84
90
|
const value = idNameMap[key];
|
|
85
91
|
nameIdMap[value] = key;
|
|
@@ -105,7 +111,7 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
|
|
|
105
111
|
*/
|
|
106
112
|
|
|
107
113
|
return _webpack.Template.asString([`const ntc = ${JSON.stringify(needsMap ? nameIdMap : {})};
|
|
108
|
-
|
|
114
|
+
const cns = Object.keys(ntc);
|
|
109
115
|
|
|
110
116
|
function clt(href, rel) {
|
|
111
117
|
let link = document.createElement("link");
|
|
@@ -123,8 +129,8 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
|
|
|
123
129
|
//return !url.includes(".undefined.");
|
|
124
130
|
return url.indexOf(".undefined") === -1;
|
|
125
131
|
}
|
|
126
|
-
function lpp(
|
|
127
|
-
|
|
132
|
+
function lpp(_chunkId, rel) {
|
|
133
|
+
let chunkId = ${_webpack.RuntimeGlobals.require}.getChunkId(_chunkId);
|
|
128
134
|
// ${_webpack.RuntimeGlobals.require}.e(chunkId);
|
|
129
135
|
if(__webpack_require__.O.j(chunkId)) {
|
|
130
136
|
return;
|
|
@@ -139,29 +145,33 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
|
|
|
139
145
|
}
|
|
140
146
|
}
|
|
141
147
|
|
|
142
|
-
${_webpack.RuntimeGlobals.require}.getChunkId = function getChunkId(
|
|
143
|
-
|
|
148
|
+
${_webpack.RuntimeGlobals.require}.getChunkId = function getChunkId(chunkId) {
|
|
149
|
+
${needsMap ? 'chunkId = ntc[chunkId]||chunkId;' : ''}
|
|
150
|
+
return chunkId;
|
|
144
151
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
152
|
+
${_webpack.RuntimeGlobals.require}.getChunkIds = function getChunkIds(chunkId) {
|
|
153
|
+
${// eslint-disable-next-line no-nested-ternary
|
|
154
|
+
this.allowPrefetchingMultipleChunks ? `
|
|
155
|
+
const isRegExAsChunkId = chunkId instanceof RegExp;
|
|
156
|
+
if(isRegExAsChunkId) {
|
|
157
|
+
return cns.filter(chunkName => chunkId.test(chunkName)).map(chunkName => ntc[chunkName]);
|
|
158
|
+
}
|
|
159
|
+
return [${_webpack.RuntimeGlobals.require}.getChunkId(chunkId)];
|
|
160
|
+
` : `return [${_webpack.RuntimeGlobals.require}.getChunkId(chunkId)];`}
|
|
161
|
+
}
|
|
162
|
+
// Prefetch a chunk (${pluginName})
|
|
163
|
+
${_webpack.RuntimeGlobals.require}.pfc = function prefetchChunk(chunkId) {
|
|
149
164
|
${`
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
})
|
|
154
|
-
// let idOfAChunk = ${_webpack.RuntimeGlobals.require}.getChunkId(chunkId);
|
|
155
|
-
// chunkIds.forEach(idOfAChunk => {
|
|
156
|
-
// ${_webpack.RuntimeGlobals.require}.e(idOfAChunk);
|
|
157
|
-
// })
|
|
158
|
-
`}
|
|
165
|
+
let chunkIds = ${_webpack.RuntimeGlobals.require}.getChunkIds(chunkId);
|
|
166
|
+
chunkIds.forEach(idOfAChunk => {
|
|
167
|
+
${_webpack.RuntimeGlobals.require}.e(idOfAChunk);
|
|
168
|
+
})`}
|
|
159
169
|
};
|
|
160
170
|
|
|
161
|
-
//
|
|
162
|
-
${_webpack.RuntimeGlobals.require}.
|
|
163
|
-
let idOfAChunk = ${_webpack.RuntimeGlobals.require}.
|
|
164
|
-
lpp(idOfAChunk, "
|
|
171
|
+
// Preload a chunk (${pluginName})
|
|
172
|
+
${_webpack.RuntimeGlobals.require}.plc = function preloadChunk(chunkId) {
|
|
173
|
+
let idOfAChunk = ${_webpack.RuntimeGlobals.require}.getChunkIds(chunkId)[0];
|
|
174
|
+
lpp(idOfAChunk, "preload");
|
|
165
175
|
}
|
|
166
176
|
` // `// Prefetch a chunk (${pluginName})`,
|
|
167
177
|
// `${RuntimeGlobals.require}.pfc = function prefetchChunk(chunkId) {`,
|
|
@@ -180,17 +190,4 @@ class ResourceHintsRuntimePlugin extends _webpack.RuntimeModule {
|
|
|
180
190
|
]);
|
|
181
191
|
}
|
|
182
192
|
|
|
183
|
-
}
|
|
184
|
-
// ${
|
|
185
|
-
// // eslint-disable-next-line no-nested-ternary
|
|
186
|
-
// this.allowPrefetchingMultipleChunks
|
|
187
|
-
// ? `
|
|
188
|
-
// const isRegExAsChunkId = chunkId instanceof RegExp;
|
|
189
|
-
// if(isRegExAsChunkId) {
|
|
190
|
-
// return cns.filter(chunkName => chunkId.test(chunkName)).map(chunkName => ntc[chunkName]);
|
|
191
|
-
// }
|
|
192
|
-
// return [${RuntimeGlobals.require}.getChunkId(chunkId)];
|
|
193
|
-
// `
|
|
194
|
-
// : `return [${RuntimeGlobals.require}.getChunkId(chunkId)];`
|
|
195
|
-
// }
|
|
196
|
-
// }
|
|
193
|
+
}
|
|
@@ -14,12 +14,8 @@ function configResourceHintsPlugin(options) {
|
|
|
14
14
|
publicPath,
|
|
15
15
|
resourceHints
|
|
16
16
|
} = options;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return null;
|
|
17
|
+
return new _ResourceHintsPlugin.default({
|
|
18
|
+
resourceHints,
|
|
19
|
+
publicPath: JSON.stringify(publicPath)
|
|
20
|
+
});
|
|
25
21
|
}
|
|
@@ -60,5 +60,5 @@ function plugins(options) {
|
|
|
60
60
|
const {
|
|
61
61
|
webpackPlugins
|
|
62
62
|
} = options;
|
|
63
|
-
return [(0, _configEnvVariables.configEnvVariables)(options), (0, _configCustomAttributesPlugin.configCustomAttributesPlugin)(options), (0, _configTPHashMappingPlugin.configTPHashMappingPlugin)(options), (0, _configCopyPublicFolders.configCopyPublicFolders)(options), (0, _configIgnorePlugin.configIgnorePlugin)(options), (0, _configMiniCSSExtractPlugin.configMiniCSSExtractPlugin)(options), (0, _configSelectorWeightPlugin.configSelectorWeightPlugin)(options), (0, _configVariableConversionPlugin.configVariableConversionPlugin)(options), (0, _configI18nSplitPlugin.configI18nSplitPlugin)(options), (0, _configRtlCssPlugin.configRtlCssPlugin)(options), (0, _configHtmlWebpackPlugin.configHtmlWebpackPlugin)(options), (0, _configCustomScriptLoadingStrategyPlugin.configCustomScriptLoadingStrategyPlugin)(options), (0, _configCdnChangePlugin.configCdnChangePlugin)(options), (0, _configServiceWorkerPlugin.configServiceWorkerPlugin)(options), (0, _configEFCTemplatePlugin.configEFCTemplatePlugin)(options), (0, _configResourceHintsPlugin.configResourceHintsPlugin)(options), (0, _configBundleAnalyzer.configBundleAnalyzer)(options), (0, _configManifestJsonPlugin.configManifestJsonPlugin)(options), (0, _configSourceMapPlugin.configSourceMapPlugin)(options), (0, _configProgressPlugin.configProgressPlugin)(options), (0, _configBundleIntegrityReport.configBundleIntegrityReport)(options), (0, _configRuntimeResourceCleanup.configRuntimeResourceCleanup)(options), (0, _configMurphyInjectorPlugin.configMurphyInjectorPlugin)(options), (0, _configChunkHierarchyPlugin.configChunkHierarchyPlugin)(options),
|
|
63
|
+
return [(0, _configEnvVariables.configEnvVariables)(options), (0, _configCustomAttributesPlugin.configCustomAttributesPlugin)(options), (0, _configTPHashMappingPlugin.configTPHashMappingPlugin)(options), (0, _configCopyPublicFolders.configCopyPublicFolders)(options), (0, _configIgnorePlugin.configIgnorePlugin)(options), (0, _configMiniCSSExtractPlugin.configMiniCSSExtractPlugin)(options), (0, _configSelectorWeightPlugin.configSelectorWeightPlugin)(options), (0, _configVariableConversionPlugin.configVariableConversionPlugin)(options), (0, _configI18nSplitPlugin.configI18nSplitPlugin)(options), (0, _configRtlCssPlugin.configRtlCssPlugin)(options), (0, _configHtmlWebpackPlugin.configHtmlWebpackPlugin)(options), (0, _configCustomScriptLoadingStrategyPlugin.configCustomScriptLoadingStrategyPlugin)(options), (0, _configCdnChangePlugin.configCdnChangePlugin)(options), (0, _configServiceWorkerPlugin.configServiceWorkerPlugin)(options), (0, _configEFCTemplatePlugin.configEFCTemplatePlugin)(options), (0, _configResourceHintsPlugin.configResourceHintsPlugin)(options), (0, _configBundleAnalyzer.configBundleAnalyzer)(options), (0, _configManifestJsonPlugin.configManifestJsonPlugin)(options), (0, _configSourceMapPlugin.configSourceMapPlugin)(options), (0, _configProgressPlugin.configProgressPlugin)(options), (0, _configBundleIntegrityReport.configBundleIntegrityReport)(options), (0, _configRuntimeResourceCleanup.configRuntimeResourceCleanup)(options), (0, _configMurphyInjectorPlugin.configMurphyInjectorPlugin)(options), (0, _configChunkHierarchyPlugin.configChunkHierarchyPlugin)(options), ...webpackPlugins].filter(Boolean);
|
|
64
64
|
}
|