|
1 | 1 | <?php |
2 | 2 |
|
3 | 3 | /* |
4 | | - * MIT License |
| 4 | + * Copyright (c) 2023 яαvoroηα |
5 | 5 | * |
6 | | - * Copyright (c) 2022 яαvoroηα |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 7 | + * this software and associated documentation files (the "Software"), to deal in |
| 8 | + * the Software without restriction, including without limitation the rights to |
| 9 | + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
| 10 | + * the Software, and to permit persons to whom the Software is furnished to do so, |
| 11 | + * subject to the following conditions: |
7 | 12 | * |
8 | | - * Permission is hereby granted, free of charge, to any person obtaining a copy of |
9 | | - * this software and associated documentation files (the "Software"), to deal in |
10 | | - * the Software without restriction, including without limitation the rights to use, |
11 | | - * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the |
12 | | - * Software, and to permit persons to whom the Software is furnished to do so, |
13 | | - * subject to the following conditions: |
| 13 | + * The above copyright notice and this permission notice shall be included in all |
| 14 | + * copies or substantial portions of the Software. |
14 | 15 | * |
15 | | - * The above copyright notice and this permission notice shall be included in all |
16 | | - * copies or substantial portions of the Software. |
17 | | - * |
18 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
19 | | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
20 | | - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
21 | | - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
22 | | - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH |
23 | | - * THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| 18 | + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 19 | + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| 20 | + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 21 | + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
24 | 22 | */ |
25 | 23 |
|
26 | 24 | namespace App; |
|
32 | 30 | */ |
33 | 31 | function hmr_enabled(): bool |
34 | 32 | { |
35 | | - return env('HMR_ENABLED') ?: false; |
| 33 | + return env('HMR_ENABLED') ?: !file_exists(get_theme_file_path('/public/manifest.json')); |
36 | 34 | } |
37 | 35 |
|
38 | 36 | /** |
39 | 37 | * Build assets hmr uri |
40 | 38 | * |
41 | 39 | * @param string $asset |
| 40 | + * |
42 | 41 | * @return string |
43 | 42 | */ |
44 | 43 | function hmr_assets(string $asset): string |
45 | 44 | { |
46 | | - $entrypoint = env('HMR_ENTRYPOINT'); |
| 45 | + $entrypoint = env('HMR_ENTRYPOINT') ?: 'http://localhost:5173'; |
47 | 46 |
|
48 | 47 | return $entrypoint ? "{$entrypoint}/{$asset}" : asset($asset); |
49 | 48 | } |
0 commit comments