使用babel后在IE中未定义“符号" [英] 'Symbol' is undefined in IE after using babel

查看:177
本文介绍了使用babel后在IE中未定义“符号"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用ES6标准编写的reactjs应用程序,并且使用webpack进行了构建. webpack使用babel-loader加载js模块.具体来说,我使用以下版本的软件包: ├── babel@5.8.34 ├── babel-core@5.8.34 ├── babel-loader@5.4.0 └── webpack@1.12.6

I have a reactjs app written using ES6 standards, and I use webpack to build it. The webpack loads the js modules using babel-loader. To be specific, I use the following versions of packages: ├── babel@5.8.34 ├── babel-core@5.8.34 ├── babel-loader@5.4.0 └── webpack@1.12.6

但是,在构建它之后,IE 10会出现以下错误'Symbol' is undefined. babel是否应该定义Symbol?我需要设置webpackbabel的任何特定配置才能使其正常工作吗?我在.babelrc中使用{stage: 0}配置.

However, after building it, the IE 10 gives the following error 'Symbol' is undefined. Shouldn't the babel be supposed to define the Symbol? Is there any specific configuration for webpack or babel I need to set in order to make it work? I use {stage: 0} configuration in my .babelrc.

任何帮助,我们将不胜感激, 谢谢!

Any help would be appreciated, Thank you !

推荐答案

好吧,我最终发现,单独babel并不能进行polyfill.包括脚本<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser-polyfill.min.js"></script>为我解决了这个问题.

Ok, I eventually found out that babel alone does no polyfill. Including script <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser-polyfill.min.js"></script> solved this issue for me.

这篇关于使用babel后在IE中未定义“符号"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆