File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -8,9 +8,14 @@ class Decorator implements ViewDecoratorInterface
88{
99 public static function decorate (string $ html ): string
1010 {
11- # Check if vite is running or manifest is ready.
12- if (Vite:: isReady () && env ('VITE_AUTO_INJECTING ' ))
11+ # Check whether vite is running or manifest is ready.
12+ if (env ('VITE_AUTO_INJECTING ' ))
1313 {
14+ if (Vite::isReady () === false )
15+ {
16+ throw new \Exception ('CodeignIter Vite package is installed, but not initialized. did you run "php spark vite:init" ? ' );
17+ }
18+
1419 # First inject app div
1520 $ html = str_replace ('<body> ' , "<body> \n\t<div id= \"app \"> " , $ html );
1621 # Close the div
Original file line number Diff line number Diff line change @@ -86,27 +86,25 @@ public static function getReactTag(): ?string
8686 }
8787
8888 /**
89- * Check if the vite is running or manifest does exist.
89+ * Check whether vite is running or manifest does exist.
9090 *
9191 * @return bool true if vite is runnig or if manifest does exist, otherwise false;
9292 */
9393 public static function isReady (): bool
9494 {
95- # Check if vite is running.
9695 $ entryFile = env ('VITE_ORIGIN ' ) . '/ ' . env ('VITE_RESOURCES_DIR ' ) . '/ ' . env ('VITE_ENTRY_FILE ' );
9796
9897 switch (true )
9998 {
10099 case @file_get_contents ($ entryFile ):
101100 $ result = true ;
102101 break ;
103- case ! empty (self ::$ manifest ):
102+ case is_file (self ::$ manifest ):
104103 $ result = true ;
105104 break ;
106105
107106 default :
108107 $ result = false ;
109- break ;
110108 }
111109
112110 return $ result ;
You can’t perform that action at this time.
0 commit comments