7

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

  • Did you run npm install? – Aymendps Jul 15 '22 at 14:45
  • Getting the same issue, tried installing the laravel-vite-plugin package but got peer dependency problems. I'd suggest filing a bug report against laravel breeze but I can't figure out how to do that... – Chris Browne Jul 21 '22 at 10:15

3 Answers3

11

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
Chris Browne
  • 1,582
  • 3
  • 15
  • 33
  • 3
    I will update this answer if/when the breeze scaffolding gets fixed and/or vite updated to 3 so that the latest laravel-vite-plugin can be used – Chris Browne Jul 21 '22 at 10:23
4

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
eylay
  • 1,712
  • 4
  • 30
  • 54
1

//delete mix

rm webpack.mix.js

//configure package.json

"scripts": {
  "dev": "vite",
  "build": "vite build",
  "serve": "vite preview"
}

add "laravel-vite-plugin": "^0.6.0", in the devDependencies

npm run build