Skip to content

Commit

Permalink
[1.x] Vite 3 support (#171)
Browse files Browse the repository at this point in the history
* vite 3 support

* don't externalise inertia server

* CS

* Use a single Vite config file

Co-authored-by: Jess Archer <[email protected]>
  • Loading branch information
timacdonald and jessarcher authored Jul 19, 2022
1 parent e846384 commit 416c092
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Console/InstallsInertiaStacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function installInertiaVueStack()
'@inertiajs/inertia-vue3' => '^0.6.0',
'@inertiajs/progress' => '^0.2.7',
'@tailwindcss/forms' => '^0.5.2',
'@vitejs/plugin-vue' => '^2.3.3',
'@vitejs/plugin-vue' => '^3.0.0',
'autoprefixer' => '^10.4.2',
'postcss' => '^8.4.6',
'tailwindcss' => '^3.1.0',
Expand Down Expand Up @@ -101,6 +101,7 @@ protected function installInertiaVueSsrStack()

copy(__DIR__.'/../../stubs/inertia-vue/resources/js/ssr.js', resource_path('js/ssr.js'));
$this->replaceInFile("input: 'resources/js/app.js',", "input: 'resources/js/app.js',".PHP_EOL." ssr: 'resources/js/ssr.js',", base_path('vite.config.js'));
$this->replaceInFile('});', ' ssr: {'.PHP_EOL." noExternal: ['@inertiajs/server'],".PHP_EOL.' },'.PHP_EOL.'});', base_path('vite.config.js'));

(new Process([$this->phpBinary(), 'artisan', 'vendor:publish', '--provider=Inertia\ServiceProvider', '--force'], base_path()))
->setTimeout(null)
Expand Down Expand Up @@ -131,7 +132,7 @@ protected function installInertiaReactStack()
'@inertiajs/inertia-react' => '^0.8.0',
'@inertiajs/progress' => '^0.2.6',
'@tailwindcss/forms' => '^0.5.2',
'@vitejs/plugin-react' => '^1.3.2',
'@vitejs/plugin-react' => '^2.0.0',
'autoprefixer' => '^10.4.2',
'postcss' => '^8.4.6',
'tailwindcss' => '^3.1.0',
Expand Down Expand Up @@ -215,6 +216,7 @@ protected function installInertiaReactSsrStack()

copy(__DIR__.'/../../stubs/inertia-react/resources/js/ssr.jsx', resource_path('js/ssr.jsx'));
$this->replaceInFile("input: 'resources/js/app.jsx',", "input: 'resources/js/app.jsx',".PHP_EOL." ssr: 'resources/js/ssr.jsx',", base_path('vite.config.js'));
$this->replaceInFile('});', ' ssr: {'.PHP_EOL." noExternal: ['@inertiajs/server'],".PHP_EOL.' },'.PHP_EOL.'});', base_path('vite.config.js'));

(new Process([$this->phpBinary(), 'artisan', 'vendor:publish', '--provider=Inertia\ServiceProvider', '--force'], base_path()))
->setTimeout(null)
Expand Down

0 comments on commit 416c092

Please sign in to comment.