@@ -98,10 +98,42 @@ If you're familiar with these tools, you can easily open the projects using the
9898php artisan native:open
9999```
100100
101+ ### Configuration
102+
103+ You can configure the folders that the ` watch ` command pays attention to in your ` config/nativephp.php ` file:
104+
105+ ``` php
106+ 'hot_reload' => [
107+ 'watch_paths' => [
108+ 'app',
109+ 'routes',
110+ 'config',
111+ 'database',
112+ // Make sure "public" is listed in your config [tl! highlight:1]
113+ 'public',
114+ ],
115+ ]
116+ ```
117+
118+ <aside >
119+
120+ #### Skip the prompts
121+
122+ If you are tired of prompts, you can run most commands - like ` native:run ` - with arguments and options that allow you
123+ to skip various prompts. Use the ` --help ` flag on a command to find out what values you can pass directly to it:
124+
125+ ``` shell
126+ php artisan native:run --help
127+ ```
128+
129+ </aside >
130+
131+
101132## Hot Reloading
102133
103134We've tried to make compiling your apps as fast as possible, but when coming from the 'make a change; hit refresh'-world
104- of PHP development that we all love, compiling apps can feel like a slow and time-consuming process.
135+ of typical browser-based PHP development that we all love, compiling apps can feel like a slow and time-consuming
136+ process.
105137
106138Hot reloading aims to make your app development experience feel just like home.
107139
@@ -111,69 +143,71 @@ You can start hot reloading by running the following command:
111143php artisan native:watch
112144```
113145
114- You can also pass the ` --watch ` option to the ` native:run ` command.
146+ <aside >
147+
148+ #### 🔥 Hot Tip!
149+
150+ You can also pass the ` --watch ` option to the ` native:run ` command. This will build and deploy a fresh version of your
151+ application to the target device and _ then_ start the watcher, all in one go.
152+
153+ </aside >
115154
116155This will start a long-lived process that watches your application's source files for changes, pushing them into the
117156emulator after any updates and reloading the current screen.
118157
119- Use this in tandem with Vite's own HMR for the platform you wish to test on:
158+ If you're using Vite, we'll also use your Node CLI tool of choice (` npm ` , ` bun ` , ` pnpm ` , or ` yarn ` ) to run Vite's HMR
159+ server.
120160
121- ``` shell
122- npm run dev -- --mode=ios
161+ ### Enabling HMR
123162
124- npm run dev -- --mode=android
125- ```
163+ To make HMR work, you'll need to add the ` hot ` file helper to your ` laravel ` plugin's config in your ` vite.config.js ` :
126164
127- This is useful during development for quickly testing changes without re-compiling your entire app. When you make
128- changes to any files in your Laravel app, the web view will be reloaded and your changes should show almost immediately.
165+ ``` js
166+ import { nativephpMobile , nativephpHotFile } from ' ./vendor/nativephp/mobile/resources/js/vite-plugin.js ' ; // [tl! focus]
129167
130- Vite HMR is perfect for apps that use SPA frameworks like Vue or React to build the UI. It even works on real devices,
131- not just simulators! As long as the device is on the same network as the development machine.
168+ export default defineConfig ({
169+ plugins: [
170+ laravel ({
171+ input: [' resources/css/app.css' , ' resources/js/app.js' ],
172+ refresh: true ,
173+ hotFile: nativephpHotFile (), // [tl! focus]
174+ }),
175+ tailwindcss (),
176+ nativephpMobile (),
177+ ]
178+ });
179+ ```
132180
133181<aside >
134182
135- #### Livewire and HMR on real devices
183+ #### Two at a time, baby!
136184
137- Full hot reloading support for Livewire on real devices is not yet available.
185+ If you're developing on macOS, you can run both Android and iOS watchers at the same time in separate terminals:
138186
139- </aside >
140-
141- ### Configuration
142-
143- You can configure the folders that the ` watch ` command pays attention to in your ` config/nativephp.php ` file:
187+ ``` shell
188+ # Terminal 1
189+ php artisan native:watch ios
144190
145- ``` php
146- 'hot_reload' => [
147- 'watch_paths' => [
148- 'app',
149- 'routes',
150- 'config',
151- 'database',
152- // Make sure "public" is listed in your config [tl! highlight:1]
153- 'public',
154- ],
155- ]
191+ # Terminal 2
192+ php artisan native:watch android
156193```
157194
158- ### Order matters
195+ This way you can see your changes reflected in real-time on both platforms ** at the same time ** . Wild.
159196
160- Depending on which order you run these commands, you may find that hot reloading doesn't work immediately. It's often
161- best to get the commands running, get your app open, and then make a request to a new screen to allow your app to pick
162- up the ` hot ` file's presence and connect to the HMR server.
163-
164-
165- <aside >
197+ </aside >
166198
199+ This is useful during development for quickly testing changes without re-compiling your entire app. When you make
200+ changes to any files in your Laravel app, the web view will be reloaded and your changes should show almost immediately.
167201
202+ Vite HMR is perfect for apps that use SPA frameworks like Vue or React to build the UI. It even works on real devices,
203+ not just simulators! As long as the device is on the same network as the development machine.
168204
169- #### Skip the prompts
205+ < aside >
170206
171- If you are tired of prompts, you can run most commands - like ` native:run ` - with arguments and options that allow you
172- to skip various prompts. Use the ` --help ` flag on a command to find out what values you can pass directly to it:
207+ #### Real iOS Devices Support
173208
174- ``` shell
175- php artisan native:run --help
176- ```
209+ Full hot reloading support works best on simulators. Full hot reloading support for non-JS changes on real iOS devices
210+ is not yet available.
177211
178212</aside >
179213
0 commit comments