laravel-mix: Uglify not working with ES6

Uglify hasn’t been working for months. uglifyjs-webpack-plugin hasn’t been updated since July 21st and there have been no commits on the repo since then.

Is there a workaround to get uglify working with the latest Laravel Mix version?
Can we maybe just switch to the beta or switch to uglify-es?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (14 by maintainers)

Most upvoted comments

@ankurk91: Neat, that worked!

import 'bootstrap/js/dist/modal';
import 'bootstrap/js/dist/dropdown';

mix.webpackConfig({
    plugins: [
        new webpack.ProvidePlugin({
            $: 'jquery',
            jQuery: 'jquery',
            Popper: ['popper.js', 'default'],
            Util: 'exports-loader?Util!bootstrap/js/dist/util',
        }),
    ]
});

I was suggesting bundle analyzer to get the correct size of each module included.

Here is the link - https://github.com/th0r/webpack-bundle-analyzer

Here is how to use this in Laravel mix

npm install --save-dev webpack-bundle-analyzer

Then in your webpack.mix.js

var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

mix.webpackConfig({
  plugins: [
     new BundleAnalyzerPlugin(),
  ]
});

Then run

npm run prod

Wait for http://127.0.0.1:8888/ to be ready for your browser. You can remove this package after using.