Feat: Creating vite-plugin.js for boboko/core
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user