mix.version() is not working (no hashes are added in mix-manifest.json)
See original GitHub issue- Laravel Mix Version: 1.4.2
- Node Version (
node -v
): v6.10.3 - NPM Version (
npm -v
): 3.10.10 - OS: Centos + MacOS
Description:
mix.version() is not generating hashed URL’s for my assets
Steps To Reproduce:
in my webpack.mix.js I have:
if (mix.inProduction()) {
console.log("We are in production");
mix.version(['public/js/app.js', 'public/css/app.css']);
}
the console log gets triggered just fine, but there are no hashes appended to my stylesheet or js file, which I’m loading in my views like so:
<link href="{{ mix('css/app.css') }}" rel="stylesheet">
the output is the following without cache busting:
<link href="/css/app.css" rel="stylesheet">
the mix-manifest.json file looks like this
{
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css",
"/js/app.js.map": "/js/app.js.map",
"/css/app.css.map": "/css/app.css.map"
}
UPDATE: this seems to be working locally on my machine, but not on my CentOS server. I’ve set permissions to 777 on the mix-manifest.json file, but that doesn’t solve the issue. I’m thinking this might be permission related? Are there any other files that mix needs to be able to write to while running the build in order to update the mix-manifest file?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:27
Top GitHub Comments
I found out that the mix configuration parameter “inProduction” has been rename to “production”. I’m using the below code for versioning.
The final JS file with hash mappings are stored in the mix-manifest.json file.
I was really stuck here for a while. If nothing above seems to work, it’s possible you’ve made the same mistake I did. Make sure you are calling mix and not asset when you include your script. Good:
<script src="{{ mix('js/app.js') }}" defer></script>
Bad:<script src="{{ asset('js/app.js') }}" defer></script>