Javascript 巴别塔网页版安可

Javascript 巴别塔网页版安可,javascript,node.js,babeljs,webpack-encore,Javascript,Node.js,Babeljs,Webpack Encore,我的浏览器控制台中出现以下错误: 未捕获引用错误:未定义regeneratorRuntime 我在这里找到了一个问题和答案,上面说要安装Babel来让它工作,所以我就开始这么做了。至于上下文,我以前从未使用过Webpack Encore或Babel。我从来都不需要。我将下面的行添加到我的网页Encore文件中,并收到另一个错误 Encore.configureBabel(()=>{}{ useBuiltIns:“用法”, }) [encore]模块构建失败(来自./node_modules/b

我的浏览器控制台中出现以下错误:

未捕获引用错误:未定义regeneratorRuntime

我在这里找到了一个问题和答案,上面说要安装Babel来让它工作,所以我就开始这么做了。至于上下文,我以前从未使用过Webpack Encore或Babel。我从来都不需要。我将下面的行添加到我的网页Encore文件中,并收到另一个错误

Encore.configureBabel(()=>{}{
useBuiltIns:“用法”,
})
[encore]模块构建失败(来自./node_modules/babel loader/lib/index.js):
RangeError:[BABEL]\resources\js\app.ts:无效选项:传递给'corejs'的版本无效。目前,只有核心-js@2和核心-js@3支持。(处理时:“\\node\u modules\\@babel\\preset env\\lib\\index.js”)
在normalizeCoreJSOption(\node\u modules\@babel\preset env\lib\normalize options.js:114:11)
在normalizeOptions(\node\u modules\@babel\preset env\lib\normalize options.js:126:18)
在\node\u modules\@babel\preset env\lib\index.js:271:37
在\node\u modules\@babel\helper插件utils\lib\index.js:22:12
异步(\node\u modules\@babel\core\lib\gensync utils\async.js:43:33)
异步(\node\u modules\gensync\index.js:186:15)
在\node\u modules\gensync\index.js:216:13
在Generator.next()处
在\node\u modules\@babel\core\lib\config\full.js:217:21
在Generator.next()处
有了这个错误,我在
useBuiltIns
下面添加了
corejs:'3.0.0',
,我得到了更多的错误。我发现的另一个问题是,corejs只会将
useBuiltIns:'usage'
过时


对于异步/等待功能来说,这一切都有点太多了。在我的浏览器中工作的功能。

您是否尝试过手动安装
core-js@3
?例如:
npm安装核心-js@3
/
纱线添加芯线-js@3
?我没有试过@Domi,但这可以追溯到我提出的观点,corejs只是呈现
useBuildIns:“用法”
过时,我不想这样。我不知道
encore
是如何工作的,但是
useBuildIns
一点也不被反对。但是,它不是一般的
babel
选项,而是
preset env
preset的选项。你可能只需要把它移到正确的地方这里的文档:@Domi没有人说
useBuiltIns
被弃用了,我确实可以在正确的位置选择安可。我一定是看错了。无论哪种方式,粘贴的代码在很大程度上都不同。我没有看到任何地方像你一样使用
configureBabel
,有两个参数,第二个是对象。他们似乎总是希望您修改作为第一个参数的回调中现有的
babelConfig
对象。在那里,您需要
推送
(或查找现有的)
预设环境
,您可以在其中添加
useBuiltIns
。但这只是他们的文档页面,因为我在安可中没有经验。
[ encore ] Module build failed (from ./node_modules/babel-loader/lib/index.js):
RangeError: [BABEL] \resources\js\app.ts: Invalid Option: The version passed to `corejs` is invalid. Currently, only core-js@2 and core-js@3 are supported. (While processing: "\\node_modules\\@babel\\preset-env\\lib\\index.js")
    at normalizeCoreJSOption (\node_modules\@babel\preset-env\lib\normalize-options.js:114:11)
    at normalizeOptions (\node_modules\@babel\preset-env\lib\normalize-options.js:126:18)
    at \node_modules\@babel\preset-env\lib\index.js:271:37
    at \node_modules\@babel\helper-plugin-utils\lib\index.js:22:12
    at async (\node_modules\@babel\core\lib\gensync-utils\async.js:43:33)
    at async (\node_modules\gensync\index.js:186:15)
    at \node_modules\gensync\index.js:216:13
    at Generator.next (<anonymous>)
    at \node_modules\@babel\core\lib\config\full.js:217:21
    at Generator.next (<anonymous>)