By default Spin Pro comes with Vite pre-installed.
| Property | Value |
|---|---|
| Development URL | https://vite.dev.test |
| Protocol | HTTPS by default |
| Port | 443 |
If for some reason your vite.config.js file is heavily modified or changed by another process, here is the default configuration that Spin Pro comes with:
import fs from 'fs';
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
server: {
host: '0.0.0.0',
hmr: {
host: 'vite.dev.test',
clientPort: 443,
},
https: {
key: fs.readFileSync('/usr/src/app/.infrastructure/conf/traefik/dev/certificates/local-dev-key.pem'),
cert: fs.readFileSync('/usr/src/app/.infrastructure/conf/traefik/dev/certificates/local-dev.pem'),
},
},
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
],
});
To use Vite, you can run the following command from your development environment:
spin run node yarn dev
In Laravel 11, you will need to force the compiled Vite assets to load over HTTPS. To do that, open the app/Providers/AppServiceProvider.php file and update the boot() method:
APP_ENV environment variable must be set to production or dev./**
* Register any application services.
*/
public function register(): void
{
if ($this->app->environment('production') || $this->app->environment('dev')) {
URL::forceScheme('https');
}
}