简体   繁体   English

关键依赖:将create-react-app从1.1.5更新到2.18

[英]Critical dependency: updating create-react-app from 1.1.5 to 2.18

Currently trying to update a create-react-app application from 1.1.5 to 2.1.8. 目前正在尝试将create-react-app应用程序从1.1.5更新到2.1.8。 Getting an error returned. 返回错误。

Critical dependency: require function is used in a way in which dependencies cannot be statically extracted 关键依赖关系:require函数的使用方式是无法静态提取依赖关系

For the following section of code. 对于以下代码部分。

// If browser doesn't support Intl (i.e. Safari), then we manually import
// the intl polyfill and locale data.
if (!window.intl) {
(require: any).ensure(
        ["intl", "intl/locale-data/jsonp/en.js", "intl/locale-data/jsonp/zh.js"],
        require => {
            require("intl");
            require("intl/locale-data/jsonp/en.js");
            require("intl/locale-data/jsonp/zh.js");
            render(renderApp, element);
    });
} else {
    // otherwise just render app normally
    render(renderApp, element);
}

Has anyone encountered this issue before or have any idea why this code is a problem now that I have update my react-scripts from 1.1.5 to 2.1.8? 有没有人之前遇到过这个问题,或者有任何想法为什么这个代码是一个问题,因为我已经将1.1.5的反应脚本更新到2.1.8?

Have been looking through similar tickets but not having much success. 一直在寻找类似的门票,但没有取得多大成功。

Any help with this would be greatly appreciated :) 任何有关这方面的帮助将非常感谢:)

UI UI

using node v11.9.0 and npm 6.7.0 使用节点v11.9.0和npm 6.7.0

Ending up removing the require code. 结束删除require代码。 Working fine. 工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM