marcelo2605's avatar

Laravel not load my edited js file

I edited my resources/assets/js/app.js file, run npm run production and upload to the server.

On my local VM, the new js file is loaded on the page. But on production server, Laravel still loading old version.

I clean the browser cache and checked that the new file is uploaded.

0 likes
6 replies
Dunsti's avatar

maybe you are behind a proxy that caches the old js-file?

Cronix's avatar

are you versioning your files with mix?

Dunsti's avatar

as @Cronix said: if you are versioning your js-files, the filename will be different with every update of the file, and this cannot be cached (because of different filenames)

marcelo2605's avatar

@Cronix

I try without success.

I add <script type="text/javascript" src="{{ mix('js/app.js') }}"></script> in master.blade.php file and change webpack.mix.js to this:

mix.js('resources/assets/js/app.js', 'public/js').sass('resources/assets/sass/app.scss', 'public/css').version();

My public/mix-manifestjson was correct, but Laravel return The Mix manifest does not exist.

marcelo2605's avatar
marcelo2605
OP
Best Answer
Level 7

Found the problem: the files are cached by Cloudflare.

Please or to participate in this conversation.