File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -326,6 +326,10 @@ class WebpackConfig {
326
326
}
327
327
328
328
splitEntryChunks ( ) {
329
+ if ( this . sharedCommonsEntryName ) {
330
+ throw new Error ( 'Using splitEntryChunks() and createSharedEntry() together is not supported. Use one of these strategies only to optimize your build.' ) ;
331
+ }
332
+
329
333
this . shouldSplitEntryChunks = true ;
330
334
}
331
335
@@ -338,6 +342,10 @@ class WebpackConfig {
338
342
}
339
343
340
344
createSharedEntry ( name , file ) {
345
+ if ( this . shouldSplitEntryChunks ) {
346
+ throw new Error ( 'Using splitEntryChunks() and createSharedEntry() together is not supported. Use one of these strategies only to optimize your build.' ) ;
347
+ }
348
+
341
349
// don't allow to call this twice
342
350
if ( this . sharedCommonsEntryName ) {
343
351
throw new Error ( 'createSharedEntry() cannot be called multiple times: you can only create *one* shared entry.' ) ;
Original file line number Diff line number Diff line change @@ -348,6 +348,15 @@ describe('WebpackConfig object', () => {
348
348
config . createSharedEntry ( 'vendor2' , './main' ) ;
349
349
} ) . to . throw ( 'cannot be called multiple' ) ;
350
350
} ) ;
351
+
352
+ it ( 'Calling with splitEntryChunks() is not supported' , ( ) => {
353
+ const config = createConfig ( ) ;
354
+ config . splitEntryChunks ( ) ;
355
+
356
+ expect ( ( ) => {
357
+ config . createSharedEntry ( 'vendor' , './main' ) ;
358
+ } ) . to . throw ( 'together is not supported' ) ;
359
+ } ) ;
351
360
} ) ;
352
361
353
362
describe ( 'autoProvideVariables' , ( ) => {
@@ -451,6 +460,15 @@ describe('WebpackConfig object', () => {
451
460
config . configureSplitChunks ( 'FOO' ) ;
452
461
} ) . to . throw ( 'must be a callback function' ) ;
453
462
} ) ;
463
+
464
+ it ( 'Calling with createdSharedEntry() is not supported' , ( ) => {
465
+ const config = createConfig ( ) ;
466
+ config . createSharedEntry ( 'vendor' , './main' ) ;
467
+
468
+ expect ( ( ) => {
469
+ config . splitEntryChunks ( ) ;
470
+ } ) . to . throw ( 'together is not supported' ) ;
471
+ } ) ;
454
472
} ) ;
455
473
456
474
describe ( 'enablePostCssLoader' , ( ) => {
You can’t perform that action at this time.
0 commit comments