-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfd4aa9
commit 8106869
Showing
13 changed files
with
293 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* @adonisjs/inertia | ||
* | ||
* (c) AdonisJS | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/// <reference types="@vavite/multibuild" /> | ||
|
||
import type { PluginOption } from 'vite' | ||
|
||
export type InertiaPluginOptions = { | ||
ssr?: | ||
| { | ||
/** | ||
* Whether or not to enable server-side rendering | ||
*/ | ||
enabled: true | ||
|
||
/** | ||
* The entrypoint for the server-side rendering | ||
*/ | ||
entrypoint: string | ||
|
||
/** | ||
* The output directory for the server-side rendering bundle | ||
*/ | ||
output?: string | ||
} | ||
| { enabled: false } | ||
} | ||
|
||
/** | ||
* Inertia plugin for Vite that is tailored for AdonisJS | ||
*/ | ||
export default function inertia(options: InertiaPluginOptions): PluginOption { | ||
return { | ||
name: 'vite-plugin-inertia', | ||
config: () => { | ||
if (!options.ssr?.enabled) return {} | ||
|
||
return { | ||
buildSteps: [ | ||
{ | ||
name: 'build-client', | ||
description: 'build inertia client bundle', | ||
config: { build: { outDir: 'build/public/assets/' } }, | ||
}, | ||
{ | ||
name: 'build-ssr', | ||
description: 'build inertia server bundle', | ||
config: { | ||
build: { | ||
ssr: true, | ||
outDir: options.ssr.output || 'build/ssr', | ||
rollupOptions: { input: options.ssr.entrypoint }, | ||
}, | ||
}, | ||
}, | ||
], | ||
} | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.