Categories
BLOG

mix auto

Mix auto

Laravel Mix Auto Extract Vendors Plugin

Laravel Mix plugin to auto extract 3rd party dependencies as vendor.js .

What was the problem?

  • Laravel Mix already has a extract() method which accepts an array of dependencies that you want to extract as vendor.js
  • Whenever you install a new package, you also need to update this list to make it work.
  • Read more on this issue

How does this plugin solve above issue?

  • This plugin will auto extract all js dependencies coming from node_modules to vendor.js file.
  • You just need to reference them in your code somewhere. For example:
  • Now vue and axios will be auto extracted to vendor.js file
  • Laravel Mix >=2.1.0

Update your webpack.mix.js

Then update your blade template

Remove any reference to extract() method in webpack.mix.js

Here are the default options, all of them are optional.

Paths are relative to the default output directory, usually ./public .

Don’t use autoExtract() method along with extract() method.

Please see CHANGELOG for more information what has changed recently.

Laravel Mix plugin to auto extract 3rd party dependencies as vendor.js.