From d91e737fa552db7941f1a2e9d0731f73f7b9e299 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Tue, 30 Jan 2024 23:36:13 +0100 Subject: [PATCH 1/2] fix: this fix vite https option --- .yarnrc.yml | 4 ++++ package.json | 2 +- vite.config.js | 6 ++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.yarnrc.yml b/.yarnrc.yml index ac9160a..d8e684b 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1 +1,5 @@ +checksumBehavior: update + +nodeLinker: node-modules + yarnPath: .yarn/releases/yarn-4.0.2.cjs diff --git a/package.json b/package.json index d38dd9a..5600ee8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": true, "type": "module", "scripts": { - "dev": "vite --https", + "dev": "vite", "build": "vite build", "lint": "eslint --ext .js *.js resources", "pretest": "php artisan migrate:fresh --database=testing", diff --git a/vite.config.js b/vite.config.js index 3941422..8297077 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,18 +1,16 @@ -import { defineConfig } from 'vite'; -import laravel from 'laravel-vite-plugin'; import basicSsl from '@vitejs/plugin-basic-ssl'; +import laravel from 'laravel-vite-plugin'; +import { defineConfig } from 'vite'; export default defineConfig({ plugins: [ laravel({ input: ['resources/css/app.css', 'resources/js/app.js'], refresh: true, - valetTls: 'touslesprenoms.test', }), basicSsl(), ], server: { - https: true, host: 'localhost', }, }); From 976b96ce3c2f51f414be8991db0f66bca84713bd Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Thu, 1 Feb 2024 08:56:09 +0100 Subject: [PATCH 2/2] update --- vite.config.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/vite.config.js b/vite.config.js index 8297077..a80bed2 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,16 +1,22 @@ import basicSsl from '@vitejs/plugin-basic-ssl'; import laravel from 'laravel-vite-plugin'; -import { defineConfig } from 'vite'; +import { defineConfig, loadEnv } from 'vite'; -export default defineConfig({ - plugins: [ - laravel({ - input: ['resources/css/app.css', 'resources/js/app.js'], - refresh: true, - }), - basicSsl(), - ], - server: { - host: 'localhost', - }, +export default defineConfig(({ mode }) => { + // Load env file based on `mode` in the current working directory. + // Set the third parameter to '' to load all env regardless of the `VITE_` prefix. + const env = loadEnv(mode, process.cwd(), ''); + const host = env.APP_HOST ? env.APP_HOST : env.APP_URL ? env.APP_URL.replace('https://', '').replace('http://', '') : 'localhost'; + return { + plugins: [ + laravel({ + input: ['resources/css/app.css', 'resources/js/app.js'], + refresh: true, + }), + basicSsl(), + ], + server: { + host: host, + }, + }; });