Feat: Creating vite-plugin.js for boboko/core

This commit is contained in:
2026-09-28 08:41:48 +03:00
parent fd3bbbe7de
commit 667e2ea2e5
7 changed files with 207 additions and 7 deletions
@@ -18,13 +18,16 @@ use Modules\Core\Cart\Services\CartService;
* CheckoutTranslationsSeeder rather than shipped as lang/ files.
*
* A consuming app wires this module in with:
* 1. `php artisan vendor:publish --tag=core-checkout-assets` — copies
* resources/js/checkout/** and resources/css/checkout.css into the
* host's own resources/ tree. Vite only ever bundles from a host's
* own resources/ directory, so these are published (an explicit,
* host-owned, re-publishable copy) rather than imported cross-package.
* 2. `import { registerCheckout } from './checkout'` in the host's own
* JS entry point, and a @vite entry for the published checkout.css.
* 1. `"@boboko/core": "file:../boboko-core"` as an npm dependency (see this
* package's own package.json `exports`), with a bind-mount of the core
* checkout into the host's Vite container so the `file:` symlink
* resolves in dev (see 3dealer's docker-compose.core-dev.yml) and
* `resolve.preserveSymlinks: true` in the host's vite.config.js so bare
* imports (stimulus, leaflet) still resolve against the host's own
* node_modules through that symlink.
* 2. `import { registerCheckout } from '@boboko/core/checkout'` in the
* host's own JS entry point, and a @vite entry for
* `node_modules/@boboko/core/resources/css/checkout.css`.
* 3. `@include('checkout::drawer')` in the host's own layout.
* See config/checkout.php for the handful of per-site settings (login
* route, single-country mode, ...) a host is expected to publish and