@@ -81,6 +81,45 @@ describe('laravel-vite-plugin', () => {
8181 expect ( ssrConfig . build . rollupOptions . input ) . toBe ( 'resources/js/ssr.ts' )
8282 } )
8383
84+ it ( 'accepts a single input within a full configuration' , ( ) => {
85+ const plugin = laravel ( {
86+ input : 'resources/js/app.ts' ,
87+ ssr : 'resources/js/ssr.ts' ,
88+ } ) [ 0 ]
89+
90+ const config = plugin . config ( { } , { command : 'build' , mode : 'production' } )
91+ expect ( config . build . rollupOptions . input ) . toBe ( 'resources/js/app.ts' )
92+
93+ const ssrConfig = plugin . config ( { build : { ssr : true } } , { command : 'build' , mode : 'production' } )
94+ expect ( ssrConfig . build . rollupOptions . input ) . toBe ( 'resources/js/ssr.ts' )
95+ } )
96+
97+ it ( 'accepts an array of inputs within a full configuration' , ( ) => {
98+ const plugin = laravel ( {
99+ input : [ 'resources/js/app.ts' , 'resources/js/other.js' ] ,
100+ ssr : [ 'resources/js/ssr.ts' , 'resources/js/other.js' ] ,
101+ } ) [ 0 ]
102+
103+ const config = plugin . config ( { } , { command : 'build' , mode : 'production' } )
104+ expect ( config . build . rollupOptions . input ) . toEqual ( [ 'resources/js/app.ts' , 'resources/js/other.js' ] )
105+
106+ const ssrConfig = plugin . config ( { build : { ssr : true } } , { command : 'build' , mode : 'production' } )
107+ expect ( ssrConfig . build . rollupOptions . input ) . toEqual ( [ 'resources/js/ssr.ts' , 'resources/js/other.js' ] )
108+ } )
109+
110+ it ( 'accepts an input object within a full configuration' , ( ) => {
111+ const plugin = laravel ( {
112+ input : { app : 'resources/js/entrypoint-browser.js' } ,
113+ ssr : { ssr : 'resources/js/entrypoint-ssr.js' } ,
114+ } ) [ 0 ]
115+
116+ const config = plugin . config ( { } , { command : 'build' , mode : 'production' } )
117+ expect ( config . build . rollupOptions . input ) . toEqual ( { app : 'resources/js/entrypoint-browser.js' } )
118+
119+ const ssrConfig = plugin . config ( { build : { ssr : true } } , { command : 'build' , mode : 'production' } )
120+ expect ( ssrConfig . build . rollupOptions . input ) . toEqual ( { ssr : 'resources/js/entrypoint-ssr.js' } )
121+ } )
122+
84123 it ( 'respects the users build.manifest config option' , ( ) => {
85124 const plugin = laravel ( {
86125 input : 'resources/js/app.js' ,
0 commit comments