使用 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屋!