Module not found: Error: Can't resolve 'laravel-vite-plugin/inertia-helpers'

Viewed 2401

i already run npm install, but When i run

npm run dev

i got error :

WARNING in ./resources/js/app.jsx 23:65-76 Critical dependency: Accessing import.meta directly is unsupported (only property access is supported)

ERROR in ./resources/js/app.jsx 15:0-75 Module not found: Error: Can't resolve 'laravel-vite-plugin/inertia-helpers' in '/Users/blow/Sites/localhost/firstApps/resources/js'

How to solved that? I used laravel 9 + react js in one bundle

2 Answers

As a workaround, you can install laravel-vite-plugin yourself but make sure you get version 0.4.0 as the latest version will conflict with the vite version used by breeze to scaffold the project (at least, this is true for vue - didn't test with react).

For copy-paste convenience:

npm install --save-dev laravel-vite-plugin@0.4.0

Same problem for me. You actually need to install 2 packages using npm. I solved it using following commands

npm install --save-dev vite laravel-vite-plugin
npm install --save-dev @vitejs/plugin-vue
Related