本文介绍了严格模式下不支持 Safari/Babel/Webpack Const 声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

Safari 无法使用此行加载我的 React 应用程序:

Safari is failing to load my React app with this line:

Const declarations are not supported in strict mode.

当我看到失败的线路时:

When I look at the line that's failing I'm seeing:

const Crypto = __webpack_require__(624)

这不是我的应用程序中的内容,因此必须由 Webpack 或其他依赖项注入.

This isn't something in my app so it must be injected by Webpack or another dependency.

Babel 不应该用 var 替换 const 吗?

Shouldn't Babel replace const with var?

It's not included in "es2015" preset. There you have only "check-es2015-constants" plugin which just checks and validates const declarations.

将 consts 转换为 vars 的插件称为transform-es2015-block-scoping",它包含在es2015"预设中.

The plugin which transforms consts into vars is called "transform-es2015-block-scoping" and it's included in "es2015" preset.

这篇关于严格模式下不支持 Safari/Babel/Webpack Const 声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 12:05