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-inwebpack.optimize.UglifyJsPlugin
plug-in.
$ npm i -D uglifyjs-webpack-plugin
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, }, }), ], };
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!