File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ This serves two purposes:
123123### Fixed
124124
125125- Added missing collection key types in Hyde facade method annotations in https://github.com/hydephp/develop/pull/1784
126+ - The ` app.js ` file will now only be compiled if it has scripts in https://github.com/hydephp/develop/pull/2028
126127
127128### Security
128129
Original file line number Diff line number Diff line change @@ -37,6 +37,13 @@ const hydeVitePlugin = () => ({
3737 }
3838} ) ;
3939
40+ const hasJavaScriptContent = ( ) => {
41+ const appJsPath = resolve ( __dirname , 'resources/assets/app.js' ) ;
42+ if ( ! fs . existsSync ( appJsPath ) ) return false ;
43+ const content = fs . readFileSync ( appJsPath , 'utf-8' ) ;
44+ return content . replace ( / \/ \* [ \s \S ] * ?\* \/ | \/ \/ .* / g, '' ) . trim ( ) . length > 0 ;
45+ } ;
46+
4047export default defineConfig ( {
4148 server : {
4249 port : 5173 ,
@@ -60,7 +67,7 @@ export default defineConfig({
6067 emptyOutDir : false ,
6168 rollupOptions : {
6269 input : [
63- resolve ( __dirname , 'resources/assets/app.js' ) ,
70+ ... ( hasJavaScriptContent ( ) ? [ resolve ( __dirname , 'resources/assets/app.js' ) ] : [ ] ) ,
6471 resolve ( __dirname , 'resources/assets/app.css' )
6572 ] ,
6673 output : {
You can’t perform that action at this time.
0 commit comments