@exapps/core
v2.0.0
Published
Shared Vite + Inertia + Laravel wiring for @exapps projects: composer-driven Vite aliases, Inertia page namespaces, tsconfig path sync and the dev-server / HMR config.
Downloads
196
Readme
@exapps/core
Shared Vite + Inertia + Laravel wiring for @exapps projects. Bundles the four pieces of glue that every @exapps Laravel app needs:
| Piece | Export | Where |
|---|---|---|
| Composer-driven Vite aliases | composerAliases() | vite.config.js → resolve.alias |
| Inertia plugin + composer page namespaces | inertia() | vite.config.js → plugins |
| tsconfig paths sync with Vite aliases | tsconfig() | vite.config.js → plugins |
| Dev-server / HMR config | hmr() | vite.config.js → server |
| Inertia page resolver (runtime) | resolvePage | app.ts → createInertiaApp({ resolve }) |
inertia() bundles the official @inertiajs/vite plugin with the composer-driven
page-loader. Pass the official plugin's options straight through (e.g.
inertia({ ssr: false })); tune the page loader via inertia({ pages: { ... } }).
It is consumed locally as a file: package — add it to the host app's
package.json:
"devDependencies": {
"@exapps/core": "file:packages/core"
}vite.config.js
import { composerAliases, inertia, tsconfig, hmr } from '@exapps/core/vite';
export default defineConfig({
plugins: [
// ...your other plugins
inertia({ ssr: false }),
tsconfig(),
],
resolve: {
alias: [
{ find: '@', replacement: '/resources/js' },
...composerAliases({ root: process.cwd() }),
],
},
server: hmr(),
});app.ts
import { createInertiaApp } from '@inertiajs/vue3';
import { resolvePage } from '@exapps/core';
createInertiaApp({
resolve: resolvePage,
// ...
});How packages opt in
A composer package contributes Vite aliases via a top-level vite.alias
map in its composer.json, and Inertia pages via
extra.inertia-page-loader:
{
"vite": {
"alias": {
"@exapps/datasets": "/vendor/exapps/datasets/resources/js/main.js",
"@exapps/datasets/*": "/vendor/exapps/datasets/resources/js/*"
}
},
"extra": {
"inertia-page-loader": { "namespace": "datasets", "pages": "resources/js/pages" }
}
}Namespaced pages then resolve as datasets::SomePage in Inertia.
