@arponascension/express-inertia 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,8 +27,15 @@
|
|
|
27
27
|
## 📦 Installation
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
npm install @arponascension/express-inertia ejs express
|
|
30
|
+
npm install @arponascension/express-inertia ejs express
|
|
31
|
+
|
|
32
|
+
# Choose one client adapter:
|
|
33
|
+
npm install @inertiajs/vue3 vue
|
|
31
34
|
npm install -D vite @vitejs/plugin-vue
|
|
35
|
+
|
|
36
|
+
# Or use React:
|
|
37
|
+
npm install @inertiajs/react react react-dom
|
|
38
|
+
npm install -D vite @vitejs/plugin-react
|
|
32
39
|
```
|
|
33
40
|
|
|
34
41
|
Peer dependencies:
|
|
@@ -114,7 +121,28 @@ createInertiaApp({
|
|
|
114
121
|
});
|
|
115
122
|
```
|
|
116
123
|
|
|
117
|
-
### 4. Configure
|
|
124
|
+
### 4. Configure the React client (`src/main.tsx`) (alternative)
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import { createRoot } from 'react-dom/client';
|
|
128
|
+
import { createInertiaApp } from '@inertiajs/react';
|
|
129
|
+
|
|
130
|
+
createInertiaApp({
|
|
131
|
+
resolve: (name) => import(`./Pages/${name}.tsx`),
|
|
132
|
+
setup({ el, App, props }) {
|
|
133
|
+
createRoot(el).render(<App {...props} />);
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
For React, use a `.tsx` entrypoint in the root view and include `@viteReactRefresh` before `@vite`:
|
|
139
|
+
|
|
140
|
+
```html
|
|
141
|
+
@viteReactRefresh
|
|
142
|
+
@vite('src/main.tsx')
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 5. Configure Vite for Vue (`vite.config.ts`)
|
|
118
146
|
|
|
119
147
|
```ts
|
|
120
148
|
import { defineConfig } from 'vite';
|
|
@@ -128,6 +156,20 @@ export default defineConfig({
|
|
|
128
156
|
});
|
|
129
157
|
```
|
|
130
158
|
|
|
159
|
+
For React, replace the Vue plugin with `@vitejs/plugin-react` and keep the same `inertiaVitePlugin()`:
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
import { defineConfig } from 'vite';
|
|
163
|
+
import react from '@vitejs/plugin-react';
|
|
164
|
+
import { inertiaVitePlugin } from '@arponascension/express-inertia/vite';
|
|
165
|
+
|
|
166
|
+
export default defineConfig({
|
|
167
|
+
plugins: [react(), inertiaVitePlugin()],
|
|
168
|
+
base: '/build/',
|
|
169
|
+
build: { manifest: true, outDir: 'public/build' },
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
131
173
|
Start Express and Vite in separate terminals during development; `inertiaVitePlugin()` writes `public/hot` so the EJS root view automatically uses the Vite dev server. Run `vite build` before production deployment to write `public/build/.vite/manifest.json`.
|
|
132
174
|
|
|
133
175
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arponascension/express-inertia",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Next-generation Inertia.js adapter and middleware for Express with Blade-style EJS components, Vite integration, and SSR support",
|
|
5
5
|
"homepage": "https://github.com/arponascension/express-inertia#readme",
|
|
6
6
|
"repository": {
|