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.');
515
+
512
516
if(this.shouldSplitEntryChunks){
513
517
thrownewError('Using splitEntryChunks() and createSharedEntry() together is not supported. Use one of these strategies only to optimize your build.');
514
518
}
@@ -528,6 +532,36 @@ class WebpackConfig {
528
532
this.addEntry(name,file);
529
533
}
530
534
535
+
addCacheGroup(name,options){
536
+
if(typeofname!=='string'){
537
+
thrownewError('Argument 1 to addCacheGroup() must be a string.');
538
+
}
539
+
540
+
if(typeofoptions!=='object'){
541
+
thrownewError('Argument 2 to addCacheGroup() must be an object.');
542
+
}
543
+
544
+
if(!options['test']&&!options['node_modules']){
545
+
thrownewError('Either the "test" option or the "node_modules" option of addCacheGroup() must be set');
546
+
}
547
+
548
+
if(options['node_modules']){
549
+
if(!Array.isArray(options['node_modules'])){
550
+
thrownewError('The "node_modules" option of addCacheGroup() must be an array');
Copy file name to clipboardExpand all lines: lib/config/validator.js
+10
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