C
C
chincharovpc2019-06-23 17:46:35
npm
chincharovpc, 2019-06-23 17:46:35

Not showing server changes, Vuejs Laravel?

The site is written in Laravel and Vuejs.
When changing vue files, I ran it in the console npm run watch, and all changes were immediately shown.
But when uploaded to the server, you need to clear the browser cache every time to see the result.
How can I do it programmatically? (I searched on Google but didn't find it)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
B
Bone, 2019-06-24
@chincharovpc

There is (should be) a webpack.mix.js file in your project folder. Add .version() there. In the base case, it looks something like this:

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

This will add a new version to your js and css files after every change.
In order for the version to be displayed in the template, you need to include css and js using the mix helper, like this:
<link href="{{ mix('/css/app.css') }}" rel="stylesheet" media="all" />
<script src="{{ mix('/js/app.js') }}"></script>

Before uploading to the server, do npm run prod

A
Alexander Pushkarev, 2019-06-23
@AXP-dev

Well, in general, laravel-mix should generate a hash for you. See how you connect files to blade. It is necessary through mix ()
And this way you can disable the cache in the browser
5d0fa8d52c301608156889.jpeg

C
Cyrus, 2019-06-23
@storm184

CTRL + F5 and SHIFT + F5 (linux) in the browser I have been using for a long time

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question