MyGit

v4.0.0

laravel-mix/laravel-mix

版本发布时间: 2018-12-11 23:57:36

laravel-mix/laravel-mix最新发布版本:v6.0.0(2020-12-22 04:31:52)

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

Bugfixes

Notes

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(). 3e478043f7d6cfc73442b2971727d8595b6a559f

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'). 7dc010451870c0b23d8e22fe5d0fa67714d7df5f

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.

相关地址:原始地址 下载(tar) 下载(zip)

查看:2018-12-11发行的版本