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.');
526
+
521
527
if(this.shouldSplitEntryChunks){
522
528
thrownewError('Using splitEntryChunks() and createSharedEntry() together is not supported. Use one of these strategies only to optimize your build.');
523
529
}
@@ -537,6 +543,36 @@ class WebpackConfig {
537
543
this.addEntry(name,file);
538
544
}
539
545
546
+
addCacheGroup(name,options){
547
+
if(typeofname!=='string'){
548
+
thrownewError('Argument 1 to addCacheGroup() must be a string.');
549
+
}
550
+
551
+
if(typeofoptions!=='object'){
552
+
thrownewError('Argument 2 to addCacheGroup() must be an object.');
553
+
}
554
+
555
+
if(!options['test']&&!options['node_modules']){
556
+
thrownewError('Either the "test" option or the "node_modules" option of addCacheGroup() must be set');
557
+
}
558
+
559
+
if(options['node_modules']){
560
+
if(!Array.isArray(options['node_modules'])){
561
+
thrownewError('The "node_modules" option of addCacheGroup() must be an array');
Copy file name to clipboardExpand all lines: lib/config/validator.js
+14Lines changed: 14 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,18 @@ 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