Level 58
Yes, you can use Vue resources with Vite and Nova with Mix. Here's how you can achieve that:
- Install Vite and Vue Resource:
npm install vite vue-resource --save-dev
- Create a
vite.config.jsfile in the root of your project and add the following code:
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()]
})
- Create a
resources/js/app.jsfile and add the following code:
import Vue from 'vue'
import VueResource from 'vue-resource'
Vue.use(VueResource)
const app = new Vue({
el: '#app'
})
- In your
webpack.mix.jsfile, add the following code:
const mix = require('laravel-mix')
const { VitePlugin } = require('laravel-mix-vite')
mix.js('resources/js/app.js', 'public/js')
.vue()
.webpackConfig({
plugins: [
new VitePlugin()
]
})
- Run the following command to compile your assets:
npm run dev
This will compile your assets using Mix and Vite. You can now use Vue Resource in your Nova and Vue projects.