vite-plugin: TypeError: laravel is not a function
- Laravel Vite Plugin Version: 0.7.2
- Laravel Version: 9.4.0
- Node Version: 16.18.1
- NPM Version: 8.19.2
- Host operating system: Windows
- Web Browser & Version: Chrome 108.0.5359.124
- Running in Sail / Docker: Docker
Description:
I’m using Laravel 9.x along with Inertia (Svelte). There is an issue when running npm run dev
: error when starting dev server:
TypeError: laravel is not a function.
Steps To Reproduce:
Bellow is vite.config.js
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import { svelte } from '@sveltejs/vite-plugin-svelte';
export default defineConfig({
plugins: [
laravel({
input: ['resources/js/app.js'],
refresh: true,
}),
svelte({
prebundleSvelteLibraries: true,
}),
],
optimizeDeps: {
include: [
'@inertiajs/inertia',
'@inertiajs/inertia-svelte',
"@inertiajs/progress",
]
}
});
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (8 by maintainers)
As a temporary fix, you may specify
"type": "module"
in thepackage.json
and then when you reference thelaravel
function, instead referencelaravel.default
.We will investigate a fix for this.
e.g.
@fpolli I see you’re using
That’s not a valid setting for a Laravel app. Please revert that and try again. @lrfahmi are you also using that?