question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uglify not working with ES6

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
tillkrusscommented, Sep 23, 2017

@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',
        }),
    ]
});
1reaction
ankurk91commented, Sep 23, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Does uglify-js support es6 and above? - Stack Overflow
1 Answer 1 · uglify-js supports JavaScript and most language features in ECMAScript. · For more exotic parts of ECMAScript, process your source ......
Read more >
It seems like uglify-js does not support es6? #659 - GitHub
UglifyJS never supported es6 feature from master, all work on es6 and later was done on a separate branch or on separate projects....
Read more >
uglify-js-es6 - npm
JavaScript parser, mangler/compressor and beautifier toolkit (harmony branch). Latest version: 2.8.9, last published: 6 years ago.
Read more >
Fun surprise: UglifyJS can't ES6 - Swizec Teller
UglifyJS doesn't support ES6. They've been working on it since at least March of 2014. As of December 6th, 2016, it's still not...
Read more >
LaravelMix does not uglify ES6 from node_modules - Laracasts
The JS build in laravel mix can not handle not compiled ES6 inside of dependecies. Is there any way to make webpack work?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found