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
logger.deprecation('Encore.createSharedEntry() is deprecated and will be removed in a future version, please use Encore.splitEntryChunks() or Encore.addCacheGroup() instead.');
506
+
503
507
if(this.shouldSplitEntryChunks){
504
508
thrownewError('Using splitEntryChunks() and createSharedEntry() together is not supported. Use one of these strategies only to optimize your build.');
505
509
}
@@ -519,6 +523,36 @@ class WebpackConfig {
519
523
this.addEntry(name,file);
520
524
}
521
525
526
+
addCacheGroup(name,options){
527
+
if(typeofname!=='string'){
528
+
thrownewError('Argument 1 to addCacheGroup() must be a string.');
529
+
}
530
+
531
+
if(typeofoptions!=='object'){
532
+
thrownewError('Argument 2 to addCacheGroup() must be an object.');
533
+
}
534
+
535
+
if(!options['test']&&!options['node_modules']){
536
+
thrownewError('Either the "test" option or the "node_modules" option of addCacheGroup() must be set');
537
+
}
538
+
539
+
if(options['node_modules']){
540
+
if(!Array.isArray(options['node_modules'])){
541
+
thrownewError('The "node_modules" option of addCacheGroup() must be an array');
Copy file name to clipboardExpand all lines: lib/config/validator.js
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,8 @@ class Validator {
29
29
this._validateDevServer();
30
30
31
31
this._validateSharedEntryName();
32
+
33
+
this._validateCacheGroupNames();
32
34
}
33
35
34
36
_validateBasic(){
@@ -75,6 +77,14 @@ class Validator {
75
77
logger.warning(`Passing "${this.webpackConfig.sharedCommonsEntryName}" to createSharedEntry() is not recommended, as it will override the built-in cache group by this name.`);
0 commit comments