Home >Web Front-end >JS Tutorial >Webpack3 compilation is compatible with IE8 instance analysis
This article mainly introduces the correct posture of compiling webpack3 compatible with IE8 in detail. The editor thinks it is quite good. Now I will share it with you and give you a reference. Let’s follow the editor to take a look, I hope it can help everyone.
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
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.
Related recommendations:
Recommended 10 articles about ie8 compatibility
How to deal with checkbox/radio onchange not being compatible with ie8 in javascript Method
bootstrap3 is compatible with IE8 browser! _javascript skills
The above is the detailed content of Webpack3 compilation is compatible with IE8 instance analysis. For more information, please follow other related articles on the PHP Chinese website!