使用babel后在IE中未定义“符号" [英] 'Symbol' is undefined in IE after using babel
问题描述
我有一个使用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
?我需要设置webpack
或babel
的任何特定配置才能使其正常工作吗?我在.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屋!