如何仅一次导入babel-polyfill

时间:2018-07-08 16:30:43

标签: javascript babel babel-polyfill

我完成了我在React Web应用程序和React Native应用程序之间共享的React库。

它使用return regeneratorRuntime.wrap替换异步。因此,我必须导入babel-polyfill才能使其正常工作。 我添加:导入“ babel-polyfill”;在我的模块index.js文件上

它运行良好,但是我的应用上出现了这个丑陋的错误:

 Uncaught Error: only one instance of babel-polyfill is allowed
        at Object.<anonymous> (index.es.js:6646)
        at Object.<anonymous> (main.4c81c635.js:11811)
        at t (bootstrap c8114fe78af615bb02e2:19)
        at Object.<anonymous> (main.4c81c635.js:19203)
        at t (bootstrap c8114fe78af615bb02e2:19)
        at Object.<anonymous> (main.4c81c635.js:15866)
        at t (bootstrap c8114fe78af615bb02e2:19)
        at Object.<anonymous> (main.4c81c635.js:18400)
        at t (bootstrap c8114fe78af615bb02e2:19)
        at Object.<anonymous> (main.4c81c635.js:17848)

你知道如何管理吗?

1 个答案:

答案 0 :(得分:0)

我将babel.rc更改为该名称,它现在可以正常工作;)

bison --version
bison (GNU Bison) 3.0.4
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.