通过Webpack 5应用程序构建后,在Internet Explorer(IE11)上停止工作 [英] After build via Webpack 5 app stoped working on Internet Explorer (IE11)
问题描述
在webpack.config.js
中进行了一些细微调整之后,如Webpacks 5.0版本中所宣布的那样,博客文章的构建在大多数浏览器中仍然有效.
但是它停止在Internet Explorer(11)中工作,因为生成的输出混合了ES6
和ES5
,因此与IE不兼容(参见图片).
由于使用各种babel插件实际上无法成功构建,所以我问自己是否存在简单"的解决方案.将ES5指定为生成的输出的方法.
从 来自Medium which seems not working anymore. Is there some "webpack built in way" in version 5.x to have ES5 as output target? From the webpack guide To v5 from v4, it says: By default, webpack's runtime code uses ES2015 syntax to build smaller bundles. If your build targets environments that don't support this syntax (like IE11), you'll need to set So you can try to set: then it will convert code to ES5. 这篇关于通过Webpack 5应用程序构建后,在Internet Explorer(IE11)上停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!webpack-5
的beta阶段开始,我在module.exports = {
output: {
filename: [name].js,
ecmaVersion: 5 // <- this flag
}
}
target: ['web', 'es5']
to revert to ES5 syntax ('web'
if target environment is browser).target: ['web', 'es5']