0

When I do a build of React using Laravel Mix using:

yarn run production

Everything shows as successful but when I test in the browser the dev tools show the following...

enter image description here

How do you ensure that Laravel mix builds React that shows as production using the React Develop Tools?

James Parsons
  • 895
  • 5
  • 18
  • 36

1 Answers1

0

What is run with yarn run production is determined in your package.json file at "scripts": {"production": .... Would be helpful to know what that says. It might be as simple as adding NODE_ENV=production before that script.

Normally you would use yarn to build your production files, which are just static files. You would then use Laravel or whatever server to serve these production files created in the build/ folder.

chuck_d
  • 121
  • 1
  • 3
  • It runs the following... "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" This is all built within Laravel and uses Laravel Mix to compile and produces an app.js file. – James Parsons Feb 16 '21 at 19:10
  • I'm not sure but I would start by deleting build/ just to make sure it wasn't cached. It also looks like cross-env might be a package that you need on the global level: https://stackoverflow.com/a/45645983/9325243. Maybe give npm a shot instead of yarn also. – chuck_d Feb 16 '21 at 20:02