diff --git a/src/package.json b/src/package.json index 36ee4c97..6b7300a2 100644 --- a/src/package.json +++ b/src/package.json @@ -1,45 +1,42 @@ { "private": true, "scripts": { - "dev": "mix", - "development": "mix", - "watch": "mix watch", - "watch-poll": "mix watch -- --watch-options-poll=1000", - "hot": "mix watch --hot", - "prod": "mix --production", - "production": "mix --production", - "lint": "eslint --ext .js,.vue resources && stylelint \"resources/themes/*.scss\"", - "jslint": "eslint --ext .js,.vue resources" + "dev": "vite", + "build": "vite build", + "prod": "vite build", + "lint": "eslint --ext .js,.vue resources && stylelint \"resources/sass/*.scss\" \"resources/vue/*.vue\"" }, "devDependencies": { "@babel/eslint-parser": "^7.17.0", "@fortawesome/fontawesome-svg-core": "^1.2.35", "@fortawesome/free-brands-svg-icons": "^6", "@fortawesome/free-regular-svg-icons": "^6", "@fortawesome/free-solid-svg-icons": "^6", "@fortawesome/vue-fontawesome": "^2.0.6", "@popperjs/core": "^2.11.5", + "@vitejs/plugin-vue2": "^2.3.1", "axios": "^1.7.2", "bootstrap": "~5.3.0", "cash-dom": "8.1.0", "cross-env": "^7.0.3", "eslint": "^7.26.0", "eslint-plugin-vue": "^7.20.0", "frappe-charts": "^1.5.8", - "laravel-mix": "^6.0.43", + "laravel-vite-plugin": "^1.0.2", "linkify-string": "^4.0.0", "mediasoup-client": "^3.6.51", "postcss": "^8.4.12", "resolve-url-loader": "^5.0.0", "sass": "^1.50.1", "sass-loader": "^8.0.0", "socket.io-client": "^4.6.1", "stylelint": "^16.6.1", "stylelint-config-standard": "^36.0.0", + "vite": "^5.2.11", "vue": "^2.6.12", "vue-i18n": "^8.27.1", "vue-loader": "^15.10.0", "vue-router": "^3.5.3", "vue-template-compiler": "^2.6.12" } } diff --git a/src/vite.config.js b/src/vite.config.js new file mode 100644 index 00000000..b34112c9 --- /dev/null +++ b/src/vite.config.js @@ -0,0 +1,69 @@ +import { defineConfig } from 'vite' +import laravel from 'laravel-vite-plugin' +import vue from '@vitejs/plugin-vue2' + +export default defineConfig({ + resolve: { + alias: { + vue: 'vue/dist/vue.esm.js', + }, + }, + plugins: [ + laravel({ + input: [ + 'resources/js/user/app.js', + 'resources/js/admin/app.js', + 'resources/js/reseller/app.js', + 'resources/themes/app.scss', + 'resources/themes/default/app.scss', + ], + refresh: true, + }), + vue({ + template: { + transformAssetUrls: { + // The Vue plugin will re-write asset URLs, when referenced + // in Single File Components, to point to the Laravel web + // server. Setting this to `null` allows the Laravel plugin + // to instead re-write asset URLs to point to the Vite + // server instead. + base: null, + + // The Vue plugin will parse absolute URLs and treat them + // as absolute paths to files on disk. Setting this to + // `false` will leave absolute URLs un-touched so they can + // reference assets in the public directory as expected. + includeAbsolute: false, + }, + }, + }), + ], +}) + + +// mix.options({ +// vue: { +// compilerOptions: { +// whitespace: 'condense' +// } +// } +// }) + +// // Prepare some resources before compilation +// mix.before(() => { +// spawn('php', ['resources/build/before.php'], { stdio: 'inherit' }) +// }) + +// // Compile the Vue/js resources +// mix.js('resources/js/user/app.js', 'public/js/user.js') +// .js('resources/js/admin/app.js', 'public/js/admin.js') +// .js('resources/js/reseller/app.js', 'public/js/reseller.js') +// .vue() + +// // Compile the themes/css resources +// glob.sync('resources/themes/*/', {}).forEach(fromDir => { +// const toDir = fromDir.replace('resources/themes/', 'public/themes/') + +// mix.sass(fromDir + 'app.scss', toDir) +// .sass(fromDir + 'document.scss', toDir); +// })