Webpack Packing Compressed ES6 file error UGLIFYJS + unexpected token punc (();

Source: Internet
Author: User

Recently do the project when the use of Vue,webpack, in the packaging and compression of the project, the other compression is no problem, but the final generated bundle.js file error, although can also run, but after all, the file size is there;

Start my solution is to write a webpack.config.js specifically configured to package the above has failed to pack the Bundle.js, packaging compression after the completion of the replacement, this will be very troublesome;

So on the internet to find a lot of methods, are said to configure the "presets": ["es2015"]; but I used it in webpack.config.js.

ES6 syntax
New Webpack. Loaderoptionsplugin ({
options:{
babel:{
Babelrc:false,
"Presets": ["es2015"]
}
}
})

Still error, no compression success; Although I have always believed that my method is not correct, but the Internet does not have a small white I have a detailed explanation, so one of the experiments, finally saw a vague version of the experiment, finally found to be in the Webpack.config.js directory to create the file. Bab ELRC, the contents are as follows

{"Presets": ["es2015"]} Ah, in fact, is the online statement, but directly omitted where to add;

Webpack Packing Compressed ES6 file error UGLIFYJS + unexpected token punc (();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.