suresh-ramani / laravel-react-vite

5 stars 2 forks source link

build/manifest.json doesn't get built #1

Closed anjanesh closed 2 years ago

anjanesh commented 2 years ago

When we install vite, "vite": "^3.0.0" gets installed by default.

I'm getting -

file_get_contents(/Users/username/workspace/laravel/laravel9-react-vite/public/build/manifest.json):
Failed to open stream: No such file or directory
$manifest = json_decode(file_get_contents(public_path('build/manifest.json')), true);

What am I doing wrong ?

suresh-ramani commented 2 years ago

Have you run "npm run dev" command?

anjanesh commented 2 years ago

Yes.

npm-run-dev php-artisan-serve manifest
anjanesh commented 2 years ago

I tried a second setup cloning your repo instead of manually doing it from the techvblogs article. composer install went fine. But npm install --force shows warnings when

$ npm install --force
npm WARN using --force Recommended protections disabled.
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @vitejs/plugin-react@2.0.0
npm WARN Found: vite@2.9.14
npm WARN node_modules/vite
npm WARN   dev vite@"^2.9.11" from the root project
npm WARN   1 more (laravel-vite-plugin)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer vite@"^3.0.0" from @vitejs/plugin-react@2.0.0
npm WARN node_modules/@vitejs/plugin-react
npm WARN   @vitejs/plugin-react@"^2.0.0" from the root project
npm WARN 
npm WARN Conflicting peer dependency: vite@3.0.9
npm WARN node_modules/vite
npm WARN   peer vite@"^3.0.0" from @vitejs/plugin-react@2.0.0
npm WARN   node_modules/@vitejs/plugin-react
npm WARN     @vitejs/plugin-react@"^2.0.0" from the root project
npm WARN deprecated @vitejs/plugin-react-refresh@1.3.6: This package has been deprecated in favor of @vitejs/plugin-react
  1. Now http://localhost:8000/ works well showing "How To Install React in Laravel 9 with Vite". So there's some issue with vite's newer version ?

  2. import './App' has to be import './App.jsx' in resources/js/app.js

suresh-ramani commented 2 years ago

No, you need to replace port 300 to 5173 in app/helper.php

anjanesh commented 2 years ago

Ahh...Thanks a lot. Didn't realize that npm run dev changed port number !