Skip to content

Releases: laravel-mix/laravel-mix

v6.0.0

21 Dec 20:31
Compare
Choose a tag to compare

This release brings Laravel Mix current with webpack 5. It additionally includes a variety of bug fixes and enhancements.

v5.0.5

20 Aug 14:50
Compare
Choose a tag to compare
5.0.5

v6.0.0-alpha.0

12 May 19:25
a3a680b
Compare
Choose a tag to compare
v6.0.0-alpha.0 Pre-release
Pre-release

Add webpack 5 support.

v5.0.0

19 Sep 17:49
Compare
Choose a tag to compare

v4.0.7

14 Dec 15:28
Compare
Choose a tag to compare
  • Fixes file path and compile issues on Windows.

v4.0.0

11 Dec 15:57
Compare
Choose a tag to compare

To Upgrade...

npm remove laravel-mix
npm install laravel-mix@4.0.0

After upgrading, if you encounter any vue-template-compiler issues, this is related to the fact that your installed version numbers of vue and vue-template-compiler must be identical. Update one or both to fix this issue.

New

  • Faster compiles
  • Faster npm installs.
  • Upgraded to webpack 4
  • Upgraded to vue-loader 15
  • Upgraded to Babel 7
  • Automatic vendor extraction. If you call mix.extract() with zero arguments, all vendor dependencies (any package from node_modules/ that you pull in) will automatically be extracted. Nifty!
  • CSS minification (via cssnano) options may be provided 887808f
  • PostCSS plugins may be passed to mix.sass/less/stylus() on a per-call basis. This means you may provide unique PostCSS plugins for each mix.sass() call, if desired. 88690a2
  • Switched JS optimizing/minification from Uglify to Terser. 5fb180e
  • Switched from node-sass to Dart Sass. While this comes with a small increased compile-time cost, the benefit is faster and more reliable npm installs. 320cecb
  • Improved Babel config merging strategy. You may now override or tweak any default Babel plugins and presets provided through Mix by creating a .babelrc file in your project root. 83f5052

Bugfixes

  • All npm audit alerts have been fixed, thanks to the upgrade to webpack 4.

Notes

  • If your project heavily uses JavaScript dynamic imports, you may need to hold off until the release of webpack 5 early next year. There are known compile issues related to this that we cannot fix until then. Once webpack 5 is out, Mix will be updated shortly after. If you're unfamiliar with dynamic imports, then this very likely won't affect your project.
  • Sass support is now an on-demand dependency. In prior versions of Mix, the node-sass and sass-loader dependencies were included out of the box, regardless of whether your project required Sass compilation or not. To help improve install times, these two dependencies will now be installed on-demand if, and only if, your project specifies Sass compilation with mix.sass(). The first time you run npm run dev, the dependencies will be installed and saved to your dev-dependencies list. 5b7a438

Breaking

Importing ES Modules

Important: As part of the vue-loader 15 updates, if your code uses the CommonJS syntax for importing EcmaScript modules, you'll need to append .default, like so:

Before

Vue.component('example-component', require('./components/ExampleComponent.vue'));

After

// Option 1: Add .default

Vue.component('example-component', require('./components/ExampleComponent.vue').default);

// Option 2 (Recommended): Switch to EcmaScript imports.

import ExampleComponent from './components/ExampleComponent.vue';

Vue.component('example-component', ExampleComponent);

Babel 7 Updates

Important: Now that Mix has been updated to support Babel 7, you may need to address a few Babel-specific breaking changes. If your project pulls in extra Babel plugins that Mix does not provide out of the box, you'll need to update your local dependencies.

  1. The naming convention for official Babel plugins has changed. They are now scoped under the @babel namespace. As such, in your package.json file, change all occurrences of "babel-plugin-[name]": "6.x" to "@babel/plugin-[name]": "7.x"
  2. If you've created a .babelrc file in your project, update all plugin name references. For example, update "plugins": ["babel-plugin-transform-object-rest-spread"] to "plugins": ["@babel/plugin-proposal-object-rest-spread"]

Node Sass to Dart Sass

As part of our switch from node-sass to dart-sass, though support is largely identical, you may notice changes or warnings upon compilation. You may either address these one-by-one, or you can manually switch back to node-sass, like so:

npm install node-sass
mix.sass('resources/sass/app.sass', 'public/css', {
    implementation: require('node-sass')
});

fastSass() and standaloneSass() Removed

mix.fastSass() and mix.standaloneSass() (aliases) have been removed entirely. In an effort to improve performance for those who only need to compile CSS, this command provided Sass compilation that was separate from the core webpack build. However, it seems to be more confusing than helpful to newcomers. Migrate by switching from mix.fastSass() to mix.sass(). 3e47804

Before

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

After

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

Deprecated .mix Property Removed

The deprecated mix property has now been removed. If you have require('laravel-mix').mix in your webpack.mix.js file, change it to require('laravel-mix'). 7dc0104

Before

let mix = require('laravel-mix').mix;

After

let mix = require('laravel-mix');

Switching From Uglify to Terser

Due to the mandatory switch from Uglify to Terser, if your project was overriding our default config with Config.uglify = {}, you'll need to switch to Config.terser = {}. The options API is largely the same.

Before

// webpack.mix.js

mix.options({
    uglify: {
        uglifyOptions: {
            warnings: true
        }
    }
});

After

mix.options({
    terser: {
        terserOptions: {
            warnings: true
        }
    }
});

Vue Component Sass Preprocessing

If your project does not include a mix.sass() call (which automatically downloads all necessary dependencies), but does specify lang="sass" in your Vue components, you may need to install either node-sass or sass. Because Mix doesn't know which preprocessors you specify in your Vue components, you'll need to manually pull them in. Fix it with npm install node-sass sass-loader or npm install sass sass-loader. Please note that the same is true for Less and Stylus.

v4.0 Beta 1

30 Nov 15:05
Compare
Choose a tag to compare
v4.0 Beta 1 Pre-release
Pre-release

npm install laravel-mix@beta

v3.0

28 Nov 14:47
Compare
Choose a tag to compare

New

Babel 7 support! As this new version of Babel includes major breaking changes, Mix, too, needs to bump from v2 to v3. We've taken care of most the changes, however, if your project pulls in extra Babel plugins that Mix does not provide out of the box, you'll need to update locally as well.

  1. The naming convention for official Babel plugins has changed. They are now scoped under the @babel namespace. As such, in your package.json file, change all occurrences of "babel-plugin-[name]": "6.x" to "@babel/plugin-[name]": "7.x"
  2. If you've created a .babelrc file in your project, update all plugin name references. For example, update "plugins": ["babel-plugin-transform-object-rest-spread"] to "plugins": ["@babel/plugin-proposal-object-rest-spread"]

Fixes

  • Updated the rootPath to the working directory of the node process. #1719
  • Fixed issues with minified css and purify. #1634

Onward

Next up, we'll be upgrading the Mix codebase to webpack 4. Stay tuned.

v2.1

13 Mar 18:04
Compare
Choose a tag to compare

New

  • Component Rewrite - Much of Mix's webpack integration has been refactored toward a component-based setup.
  • User Extensions - As part of the component rewrite, Mix now exposes an API (mix.extend()) to extend its functionality to plugin authors. (Think: npm install laravel-mix-my-extension)
  • CoffeeScript support has returned. Use mix.coffee() to install the necessary dependencies and compile your .coffee files.

Fixes

  • #1467 Fix "extractVueStyles not using specified file"

v2.0

23 Jan 18:50
Compare
Choose a tag to compare

(Potentially) Breaking

  • #1367 Distinguish better between font and image SVGs. (Depending upon your project structure, this may change the output path for certain SVG files. Please review #1367 for the related discussion.)

New

  • 2fc80f8 Add mix.babelConfig() to main API. (Now you don't have to create a .babelrc file to add a single plugin or two.)
  • #1406 Allow multiple mix.webpackConfig() calls.
  • #1342 Sort manifest key-value pairs by key.
  • #1246 Add support for HMR on different hosts and ports.
  • a7ce542 Make .env MIX_ config available to webpack.mix.js.
  • bd3dc42 Allow custom autoprefixer config, or disable it entirely.
  • c679e0b Add glob support for mix.js(). (mix.js('src/*.js', 'dist').
  • #1425 Add automated CI testing for pull requests.

Updates

  • 8e8aeff Allow for custom vue-loader configuration.
  • #1354 Update webpack's devtool option to a full source-map.
  • #1374 Add dependency verification when using globalVueStyles option.

Fixes

  • #1420 Find temporary script by name.