mtctonyhkhk2010's avatar

Can I version specific file in Laravel mix?

The current mix version() function version all compiled files. However I don't want some of the compiled files to be versioned. Can I do that? The version() function in elixir only versions the file which I called the version() on it. Can I have this back?

0 likes
9 replies
mtctonyhkhk2010's avatar

Hi, Jeffery,

When I run mix.version(['path/to/thefiles.js']), it always return

no such file or directory, open 'path/to/thefiles.js'

It seems Mix always delete the original file before it actually run version() on it. Please help. Thanks.

zippex's avatar

Hi there,

same for me, especially the combination of extract() and version() does not work.

mix
  .js('resources/assets/js/app.js', 'public/js')
    .extract([
      'vue', 'axios', 'lodash'
    ]);

if (mix.config.inProduction) {
  mix.version(['public/js/manifest.js', 'public/js/app.js']);
}

I wanted to extract the vendors and then version just my app.js... but as mentioned above, the unversioned vendor.js will be deleted while npm run production.

What do I miss? Thanks in advance for any hint :)

zippex's avatar

I always feel guilty when stumbling over my own questions. YES, there is no vendor.js anymore after mix.version() BUT the versioned vendor.123random.js does not change at all. Same name, same file, no cache busting - so perhaps Webpack is just too smart for me ;)

dmsone97's avatar

Same issue for me too when ever I pass a specific file into the version I get the errors Error: ENOENT: no such file or directory, open 'public/css/app.css'

Please or to participate in this conversation.