Skip to content

Commit

Permalink
fix: this fix vite https option (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Feb 1, 2024
1 parent a6cf9be commit 10f019e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
4 changes: 4 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
checksumBehavior: update

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.2.cjs
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
34 changes: 19 additions & 15 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
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, loadEnv } 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',
},
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,
},
};
});

0 comments on commit 10f019e

Please sign in to comment.