@@ -733,6 +733,65 @@ test('default sharedConfigBuild true on build api', async () => {
733733 expect ( counter ) . toBe ( 1 )
734734} )
735735
736+ test . for ( [ true , false ] ) (
737+ 'minify per environment (builder.sharedPlugins: %s)' ,
738+ async ( sharedPlugins ) => {
739+ const root = resolve ( __dirname , 'fixtures/shared-plugins/minify' )
740+ const builder = await createBuilder ( {
741+ root,
742+ logLevel : 'warn' ,
743+ environments : {
744+ client : {
745+ build : {
746+ outDir : './dist/client' ,
747+ rollupOptions : {
748+ input : '/entry.js' ,
749+ } ,
750+ } ,
751+ } ,
752+ ssr : {
753+ build : {
754+ outDir : './dist/server' ,
755+ rollupOptions : {
756+ input : '/entry.js' ,
757+ } ,
758+ } ,
759+ } ,
760+ custom1 : {
761+ build : {
762+ minify : true ,
763+ outDir : './dist/custom1' ,
764+ rollupOptions : {
765+ input : '/entry.js' ,
766+ } ,
767+ } ,
768+ } ,
769+ custom2 : {
770+ build : {
771+ minify : false ,
772+ outDir : './dist/custom2' ,
773+ rollupOptions : {
774+ input : '/entry.js' ,
775+ } ,
776+ } ,
777+ } ,
778+ } ,
779+ builder : {
780+ sharedPlugins,
781+ } ,
782+ } )
783+ const client = await builder . build ( builder . environments . client )
784+ const ssr = await builder . build ( builder . environments . ssr )
785+ const custom1 = await builder . build ( builder . environments . custom1 )
786+ const custom2 = await builder . build ( builder . environments . custom2 )
787+ expect (
788+ ( [ client , ssr , custom1 , custom2 ] as RollupOutput [ ] ) . map (
789+ ( o ) => o . output [ 0 ] . code . split ( '\n' ) . length ,
790+ ) ,
791+ ) . toEqual ( [ 2 , 5 , 2 , 5 ] )
792+ } ,
793+ )
794+
736795test ( 'adjust worker build error for worker.format' , async ( ) => {
737796 try {
738797 await build ( {
0 commit comments