Skip to content

Commit 59d55fd

Browse files
authored
add vite isRunningHot check to admin_head filter
Adding a check for Vite::isRunningHot() because there is no manifest.json that could be parsed for dependencies if build was done before which will result in an error.
1 parent 5ffb563 commit 59d55fd

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

app/setup.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@
3333
return;
3434
}
3535

36-
$dependencies = json_decode(Vite::content('editor.deps.json'));
37-
38-
foreach ($dependencies as $dependency) {
39-
if (! wp_script_is($dependency)) {
40-
wp_enqueue_script($dependency);
36+
if(!Vite::isRunningHot()) {
37+
$dependencies = json_decode(Vite::content('editor.deps.json'));
38+
39+
foreach ($dependencies as $dependency) {
40+
if (! wp_script_is($dependency)) {
41+
wp_enqueue_script($dependency);
42+
}
4143
}
4244
}
43-
4445
echo Vite::withEntryPoints([
4546
'resources/js/editor.js',
4647
])->toHtml();

0 commit comments

Comments
 (0)