@@ -346,39 +346,67 @@ module.exports = function createNeutrinoConfig({
346346 . merge ( {
347347 splitChunks : {
348348 cacheGroups : {
349- react : {
350- test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] ( r e a c t | r e a c t - d o m | i 1 8 n e x t ) [ \\ / ] / ,
351- name : 'view- vendor' ,
349+ 'vendor- react' : {
350+ test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] ( r e a c t | r e a c t - d o m | s c h e d u l e r | p r o p - t y p e s | o b j e c t - a s s i g n | l o o s e - e n v i f y | i 1 8 n e x t ) [ \\ / ] / ,
351+ name : 'vendor-react ' ,
352352 chunks : 'all' ,
353- priority : 100
353+ priority : 100 ,
354+ enforce : true
354355 } ,
355356 franc : {
356357 test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] f r a n c / ,
357358 name : 'franc' ,
358359 chunks : 'all' ,
359360 priority : 100
360361 } ,
361- dexie : {
362+ 'vendor- dexie' : {
362363 test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] d e x i e / ,
363- name : 'dexie' ,
364+ name : 'vendor- dexie' ,
364365 chunks : 'all' ,
365366 priority : 100
366367 } ,
368+ 'vendor-dompurify' : {
369+ test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] d o m p u r i f y [ \\ / ] / ,
370+ name : 'vendor-dompurify' ,
371+ chunks : 'all' ,
372+ priority : 120 ,
373+ enforce : true
374+ } ,
367375 wordpage : {
368376 test : ( module , chunks ) => module . resource &&
369377 module . resource . includes ( `${ path . sep } src${ path . sep } ` ) &&
370378 ! module . resource . includes ( `${ path . sep } node_modules${ path . sep } ` ) ,
371379 name : 'wordpage' ,
372380 chunks : ( { name } ) => / ^ ( n o t e b o o k | h i s t o r y ) $ / . test ( name ) ,
373381 } ,
374- antd : {
382+ 'vendor- antd' : {
375383 test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] / ,
376- name : 'antd' ,
384+ name : 'vendor- antd' ,
377385 chunks : ( { name } ) => / ^ ( o p t i o n s | n o t e b o o k | h i s t o r y ) $ / . test ( name ) ,
378386 }
379387 }
380388 } ,
381389 } )
390+
391+ neutrino . config . optimization . minimizer ( 'terser' ) . use ( {
392+ apply : compiler => {
393+ const TerserPlugin = require ( 'terser-webpack-plugin' )
394+ const SourceMapDevToolPlugin = require ( 'webpack/lib/SourceMapDevToolPlugin' )
395+
396+ new TerserPlugin ( {
397+ cache : true ,
398+ parallel : true ,
399+ sourceMap :
400+ ( compiler . options . devtool &&
401+ / s o u r c e - ? m a p / . test ( compiler . options . devtool ) ) ||
402+ ( compiler . options . plugins &&
403+ compiler . options . plugins . some (
404+ plugin => plugin instanceof SourceMapDevToolPlugin
405+ ) ) ,
406+ exclude : / (?: ^ | [ \\ / ] ) a s s e t s [ \\ / ] (?: v e n d o r - [ \d a - z - _ ] + ) \. [ \d a - f ] + \. j s (?: \? .* ) ? $ / i
407+ } ) . apply ( compiler )
408+ }
409+ } )
382410 }
383411
384412 if ( argv . debug ) {
0 commit comments