From a2c240df7bb30a4498ebce2ad2941ff497379683 Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Wed, 1 Jun 2022 17:24:03 +1000 Subject: [PATCH 1/6] Use Vite --- .env.example | 4 ++-- .styleci.yml | 2 +- package.json | 14 +++++--------- resources/js/app.js | 1 + resources/js/bootstrap.js | 4 ++-- vite.config.js | 8 ++++++++ webpack.mix.js | 17 ----------------- 7 files changed, 19 insertions(+), 31 deletions(-) create mode 100644 vite.config.js delete mode 100644 webpack.mix.js diff --git a/.env.example b/.env.example index 9bb1bd7c48a..1a3340437b5 100644 --- a/.env.example +++ b/.env.example @@ -48,5 +48,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/.styleci.yml b/.styleci.yml index 79f63b44fdc..4705a373849 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -8,5 +8,5 @@ php: js: finder: not-name: - - webpack.mix.js + - vite.config.js css: true diff --git a/package.json b/package.json index 7a9aecdf303..897c31a8e5b 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,14 @@ { "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.25", - "laravel-mix": "^6.0.6", + "laravel-vite-plugin": "^0.1.2", "lodash": "^4.17.19", - "postcss": "^8.1.14" + "postcss": "^8.1.14", + "vite": "^2.9.9" } } diff --git a/resources/js/app.js b/resources/js/app.js index e59d6a0adf7..9af0ba73f2d 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1 +1,2 @@ import './bootstrap'; +import '../css/app.css'; diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js index bbcdba42b35..a954d249086 100644 --- a/resources/js/bootstrap.js +++ b/resources/js/bootstrap.js @@ -25,7 +25,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 // }); diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 00000000000..9c38c6acafb --- /dev/null +++ b/vite.config.js @@ -0,0 +1,8 @@ +import { defineConfig } from 'vite' +import laravel from 'laravel-vite-plugin' + +export default defineConfig({ + plugins: [ + laravel(), + ], +}) diff --git a/webpack.mix.js b/webpack.mix.js deleted file mode 100644 index 2a22dc1206a..00000000000 --- 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 8b3950cbc04e7031bbddf23d793a87bbde892347 Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Wed, 1 Jun 2022 17:25:27 +1000 Subject: [PATCH 2/6] Gitignore Vite build directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index bc67a663bb4..87ead15d8f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /node_modules +/public/build /public/hot /public/storage /storage/*.key From 6b43cfa228e053f971ade13fd10d4ef268b6277a Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Mon, 13 Jun 2022 10:32:50 +1000 Subject: [PATCH 3/6] Use CSS entry points --- package.json | 4 ++-- resources/js/app.js | 1 - vite.config.js | 5 ++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 897c31a8e5b..5dc61209347 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,9 @@ }, "devDependencies": { "axios": "^0.25", - "laravel-vite-plugin": "^0.1.2", + "laravel-vite-plugin": "^0.1.3", "lodash": "^4.17.19", "postcss": "^8.1.14", - "vite": "^2.9.9" + "vite": "^2.9.11" } } diff --git a/resources/js/app.js b/resources/js/app.js index 9af0ba73f2d..e59d6a0adf7 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,2 +1 @@ import './bootstrap'; -import '../css/app.css'; diff --git a/vite.config.js b/vite.config.js index 9c38c6acafb..52ce99f1a6e 100644 --- a/vite.config.js +++ b/vite.config.js @@ -3,6 +3,9 @@ import laravel from 'laravel-vite-plugin' export default defineConfig({ plugins: [ - laravel(), + laravel([ + 'resources/css/app.css', + 'resources/js/app.js', + ]), ], }) From f79422734d5927ffaa18b818171a8b5fe234404d Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Tue, 14 Jun 2022 12:58:02 +1000 Subject: [PATCH 4/6] Update plugin --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5dc61209347..8896fcf96d8 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ }, "devDependencies": { "axios": "^0.25", - "laravel-vite-plugin": "^0.1.3", + "laravel-vite-plugin": "^0.2.0", "lodash": "^4.17.19", "postcss": "^8.1.14", "vite": "^2.9.11" From c6eabb66232ae3ce1139cf19171f7f2a97804646 Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Wed, 15 Jun 2022 14:27:38 +1000 Subject: [PATCH 5/6] Linting --- vite.config.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vite.config.js b/vite.config.js index 52ce99f1a6e..dd941926f31 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,5 +1,5 @@ -import { defineConfig } from 'vite' -import laravel from 'laravel-vite-plugin' +import { defineConfig } from 'vite'; +import laravel from 'laravel-vite-plugin'; export default defineConfig({ plugins: [ @@ -8,4 +8,4 @@ export default defineConfig({ 'resources/js/app.js', ]), ], -}) +}); From 5aa18b65e6ce1e36d8bb2f9820a9e10e3fe08896 Mon Sep 17 00:00:00 2001 From: Jess Archer Date: Fri, 17 Jun 2022 09:46:37 +1000 Subject: [PATCH 6/6] Update plugin --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8896fcf96d8..724e911ff44 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ }, "devDependencies": { "axios": "^0.25", - "laravel-vite-plugin": "^0.2.0", + "laravel-vite-plugin": "^0.2.1", "lodash": "^4.17.19", "postcss": "^8.1.14", "vite": "^2.9.11"