Home > Web Front-end > JS Tutorial > Detailed interpretation of webpack3 compilation compatible with IE8 (detailed tutorial)

Detailed interpretation of webpack3 compilation compatible with IE8 (detailed tutorial)

亚连
Release: 2018-06-19 14:21:56
Original
2404 people have browsed it

This article mainly introduces the correct posture of compiling webpack3 compatible with IE8 in detail. Now I share it with you and give you a reference.

After the method in the previous article was updated with webpack, the uglify cache address also changed, and the address needs to be found again.

Later testing found that both uglify-js2 and uglify-js3 support IE8 compatible processing.

But adding configuration parameters to webpack.optimize.UglifyJsPlugin has no effect. (Webpack’s fault)

You can’t manually find the webpack cache path to hijack it every time, that would be crazy.

UglifyjsWebpackPlugin

The key point is still the UglifyjsWebpackPlugin plug-in, but it is not a built-in webpack.optimize.UglifyJsPlugin plug-in.

$ npm i -D uglifyjs-webpack-plugin
Copy after login

You can install this plug-in separately and use it.

const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
module.exports = {
 entry: './app.js',
 output: {
  filename: 'bundle.js',
 },
 plugins: [
  new UglifyJsPlugin({
   uglifyOptions: {
    ie8: true,
   },
  }),
 ],
};
Copy after login

Do you feel like you have returned to nature?

ps: webpack 2 and 3 versions are supported.

Summary

This discovery was made by a colleague who discovered that uglify-js3 also supports ie8 compatibility processing.

Then I re-tested it several times, and checked the webpack official website plug-in to verify the feasibility.

Otherwise I may continue to use the cumbersome method before.

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

How to use js to implement reassignment

How to use nodejs to operate the fill, delete, modify and query module of mongodb

How to implement verification code countdown in JS

How to implement a chat room using socket.io

In AngularJS How to implement drag-and-drop function in JS

How to implement finger sliding carousel on mobile terminal in JS

How to achieve seamless text scrolling using JS

How to use the Node layer to implement multipart form file upload

How to use React to encapsulate Portal reusable components

How to send requests to the intermediate service layer in node (detailed tutorial)

The above is the detailed content of Detailed interpretation of webpack3 compilation compatible with IE8 (detailed tutorial). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template