Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/Pollora/framework/compare/v13.34.0-beta...develop)

### Fixed
- While Vite ran hot, its client was enqueued with WordPress's version appended (`@vite/client?ver=7.1.2`). The modules Vite serves import `/@vite/client` by its bare URL, so the browser loaded the client twice, as two modules with two HMR connections. It is enqueued with no version, like the entries (regression from v13.34.0-beta)

### Changed
- `pollora:make:theme` activates the generated theme only where the site needs one. A site with no usable theme — a first install — gets it without a question; a site that already has one keeps it unless the answer is "yes", now the default "no", so `--no-interaction` never replaces a working theme. `--activate` and `--no-activate` settle it without asking, and `pollora:install` passes `--activate`. Activation goes through `switch_theme()`, which fires `switch_theme` and `after_switch_theme`; the options were written directly before, so those hooks never ran

Expand Down
4 changes: 3 additions & 1 deletion src/Asset/Infrastructure/Services/AssetEnqueuer.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ protected function loadViteClient(string $hook): void
$url = $this->viteManager instanceof ViteManager ? $this->viteManager->clientUrl() : '';

if ($url !== '') {
wp_enqueue_script_module('vite-client/'.md5($url), $url);
// No version: the modules Vite serves import /@vite/client by its bare URL,
// and a ?ver= copy would be a second client, with its own HMR connection.
wp_enqueue_script_module('vite-client/'.md5($url), $url, [], null);
}
}, 1);

Expand Down
3 changes: 2 additions & 1 deletion tests/Feature/Asset/AssetEnqueuerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ function viteEnqueuer(ViteManager $viteManager, array $settings = []): AssetEnqu
$callback();

expect([$hook, $priority])->toBe(['wp_enqueue_scripts', 1])
->and(array_column($this->modules, 'src'))->toBe(['https://site.test:5173/@vite/client']);
->and(array_column($this->modules, 'src'))->toBe(['https://site.test:5173/@vite/client'])
->and(array_column($this->modules, 'version'))->toBe([null]);
});
});

Expand Down
Loading