From 6b6fd98de51c0003791b57b14caab0b0998a200b Mon Sep 17 00:00:00 2001 From: Shift Date: Sun, 3 Jul 2022 11:27:05 +0000 Subject: [PATCH 1/8] Bump `laravel/framework` dependency --- composer.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 83171cc..bf8a8eb 100644 --- a/composer.json +++ b/composer.json @@ -2,13 +2,16 @@ "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", - "keywords": ["framework", "laravel"], + "keywords": [ + "framework", + "laravel" + ], "license": "MIT", "require": { "php": "^8.0", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", - "laravel/framework": "^8.54", + "laravel/framework": "^9.19", "laravel/sanctum": "^2.11", "laravel/tinker": "^2.5" }, From fdbf904df6b70c75a09147df6aba1606d0c982e0 Mon Sep 17 00:00:00 2001 From: Shift Date: Sun, 3 Jul 2022 11:27:05 +0000 Subject: [PATCH 2/8] Add npm dependencies --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 00c6506..439afd8 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,9 @@ }, "devDependencies": { "axios": "^0.21", - "laravel-mix": "^6.0.6", "lodash": "^4.17.19", - "postcss": "^8.1.14" + "postcss": "^8.1.14", + "vite": "^2.9.12", + "laravel-vite-plugin": "^0.2.2" } } From 85523a34d75df6b85dcdcf436435b68e1973482c Mon Sep 17 00:00:00 2001 From: Shift Date: Sun, 3 Jul 2022 11:27:05 +0000 Subject: [PATCH 3/8] Update build scripts --- package.json | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 439afd8..dabb9f9 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,8 @@ { "private": true, "scripts": { - "dev": "npm run development", - "development": "mix", - "watch": "mix watch", - "watch-poll": "mix watch -- --watch-options-poll=1000", - "hot": "mix watch --hot", - "prod": "npm run production", - "production": "mix --production" + "dev": "vite", + "build": "vite build" }, "devDependencies": { "axios": "^0.21", From 04bc15515ac08b7db831d24a5bab571af1f77887 Mon Sep 17 00:00:00 2001 From: Shift Date: Sun, 3 Jul 2022 11:27:05 +0000 Subject: [PATCH 4/8] Configure Vite --- vite.config.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 vite.config.js diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..dd94192 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,11 @@ +import { defineConfig } from 'vite'; +import laravel from 'laravel-vite-plugin'; + +export default defineConfig({ + plugins: [ + laravel([ + 'resources/css/app.css', + 'resources/js/app.js', + ]), + ], +}); From 7d41859a32525352bde540dffb20e947acf3ca62 Mon Sep 17 00:00:00 2001 From: Shift Date: Sun, 3 Jul 2022 11:27:05 +0000 Subject: [PATCH 5/8] Remove `webpack.mix.js` --- webpack.mix.js | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 webpack.mix.js diff --git a/webpack.mix.js b/webpack.mix.js deleted file mode 100644 index 2a22dc1..0000000 --- a/webpack.mix.js +++ /dev/null @@ -1,17 +0,0 @@ -const mix = require('laravel-mix'); - -/* - |-------------------------------------------------------------------------- - | Mix Asset Management - |-------------------------------------------------------------------------- - | - | Mix provides a clean, fluent API for defining some Webpack build steps - | for your Laravel applications. By default, we are compiling the CSS - | file for the application as well as bundling up all the JS files. - | - */ - -mix.js('resources/js/app.js', 'public/js') - .postCss('resources/css/app.css', 'public/css', [ - // - ]); From 5901c3b85ecb94400ed7cf6f17a1dc6fe624b7a7 Mon Sep 17 00:00:00 2001 From: Shift Date: Sun, 3 Jul 2022 11:27:05 +0000 Subject: [PATCH 6/8] Use ES modules --- resources/js/app.js | 2 +- resources/js/bootstrap.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/resources/js/app.js b/resources/js/app.js index 40c55f6..e59d6a0 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1 +1 @@ -require('./bootstrap'); +import './bootstrap'; diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js index 6922577..7e155ec 100644 --- a/resources/js/bootstrap.js +++ b/resources/js/bootstrap.js @@ -1,4 +1,5 @@ -window._ = require('lodash'); +import _ from 'lodash'; +window._ = _; /** * We'll load the axios HTTP library which allows us to easily issue requests @@ -6,7 +7,8 @@ window._ = require('lodash'); * CSRF token as a header based on the value of the "XSRF" token cookie. */ -window.axios = require('axios'); +import axios from 'axios'; +window.axios = axios; window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; From 8be1cde44eeabb2520293e29f3ee5d4dea138255 Mon Sep 17 00:00:00 2001 From: Shift Date: Sun, 3 Jul 2022 11:27:06 +0000 Subject: [PATCH 7/8] Rename ENV variables --- .env.example | 4 ++-- resources/js/bootstrap.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 1d5caf3..f84f53d 100644 --- a/.env.example +++ b/.env.example @@ -47,5 +47,5 @@ PUSHER_APP_KEY= PUSHER_APP_SECRET= PUSHER_APP_CLUSTER=mt1 -MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" -MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" +VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" +VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js index 7e155ec..0f3a0a1 100644 --- a/resources/js/bootstrap.js +++ b/resources/js/bootstrap.js @@ -24,7 +24,7 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; // window.Echo = new Echo({ // broadcaster: 'pusher', -// key: process.env.MIX_PUSHER_APP_KEY, -// cluster: process.env.MIX_PUSHER_APP_CLUSTER, +// key: import.meta.env.VITE_PUSHER_APP_KEY, +// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER, // forceTLS: true // }); From 2ac506abd4e9e1f7cdf570c540027704c623cb9b Mon Sep 17 00:00:00 2001 From: Shift Date: Sun, 3 Jul 2022 11:27:06 +0000 Subject: [PATCH 8/8] Ignore build assets --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index eb003b0..a20b91a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /node_modules /public/hot +/public/build /public/storage /storage/*.key /vendor