tonka-vite-plugin 1.30.0 → 1.31.0
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 +6 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,10 +14,9 @@ This plugin automates the configuration of Vite for applications using **Inertia
|
|
|
14
14
|
|
|
15
15
|
## 📦 Installation
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
2. Paste the code provided in the documentation into this file.
|
|
17
|
+
```bash
|
|
18
|
+
npm i tonka-vite-plugin
|
|
19
|
+
```
|
|
21
20
|
|
|
22
21
|
## 🚀 Quick Start
|
|
23
22
|
|
|
@@ -26,7 +25,7 @@ Import the plugin into your `vite.config.ts` to activate it.
|
|
|
26
25
|
```typescript
|
|
27
26
|
import { defineConfig } from 'vite';
|
|
28
27
|
import react from '@vitejs/plugin-react';
|
|
29
|
-
import tonka from '
|
|
28
|
+
import tonka from 'tonka-vite-plugin';
|
|
30
29
|
|
|
31
30
|
export default defineConfig({
|
|
32
31
|
plugins: [
|
|
@@ -68,14 +67,14 @@ When you run `npm run build`, the plugin automatically configures Rollup (the bu
|
|
|
68
67
|
If you provide an `ssr` entry point, the plugin configures Vite to perform a second build specifically for the server. This allows your backend (Tonka) to render the initial page state on the server for faster load times and SEO.
|
|
69
68
|
|
|
70
69
|
### 3. Integration with Backend
|
|
71
|
-
The plugin prepares the assets, but the **injection** of the `<script>` tags into the HTML is handled by your backend (Tonka) via the `@vite`
|
|
70
|
+
The plugin prepares the assets, but the **injection** of the `<script>` tags into the HTML is handled by your backend (Tonka) via the `@vite` directive. This ensures that the correct script source is used:
|
|
72
71
|
* **Dev**: Points to `http://localhost:5173/@vite/client` (for HMR).
|
|
73
72
|
* **Prod**: Points to `/build/assets/xxxxx.js` (using the manifest).
|
|
74
73
|
|
|
75
74
|
## 🛠️ Development vs Production
|
|
76
75
|
|
|
77
76
|
**In Development:**
|
|
78
|
-
The plugin ensures the dev server runs on port 5173 and resolves aliases correctly. It relies on the backend to proxy requests or inject the client script.
|
|
77
|
+
The plugin ensures the dev server runs on port `5173` (or the one you specify for vite) and resolves aliases correctly. It relies on the backend to proxy requests or inject the client script.
|
|
79
78
|
|
|
80
79
|
**In Production:**
|
|
81
80
|
The plugin is essential to correctly generate the `manifest.json`. Without this plugin generating the manifest, your backend would fail to locate the compiled `.js` files after a build.
|
package/package.json
CHANGED