create-react-app 在 express/lib/view.js 中产生 'the request of a dependency is an expression'

create-react-app yields 'the request of a dependency is an expression' in express/lib/view.js

我正在尝试快速开始使用 React,并且喜欢 Facebook 创建并在此处描述的 create-react-app 工具的简单性:

https://facebook.github.io/react/blog/2016/07/22/create-apps-with-no-configuration.html

谁能告诉我这里出了什么问题?

我正在尝试将它与 FeatherJS 结合并将此依赖项添加到 package.json:

"feathers": "^2.0.0"

这对 App.js:

import feathers from 'feathers';

现在我的网络应用程序无法加载,我在控制台中收到此错误:

    Compiled with warnings.

    Warning in ./src/App.js

    /Users/nikolaschou/Dev/newbanking/payment-window/src/App.js
    4:8  warning  'feathers' is defined but never used  no-unused-vars

    ✖ 1 problem (0 errors, 1 warning)


    Warning in ./~/express/lib/view.js
    Critical dependencies:
    78:29-56 the request of a dependency is an expression
    @ ./~/express/lib/view.js 78:29-56

    You may use special comments to disable some warnings.
    Use // eslint-disable-next-line to ignore the next line.
    Use /* eslint-disable */ to ignore all warnings in a file.

根据 its documentation 判断,feathers ifself 是 服务器 和 运行 在节点上。

另一方面,React 应用程序是 客户端应用程序 和 运行 浏览器中的应用程序。

您不能将 feathers 导入浏览器应用程序,因为它是一个仅供服务器使用的库。

Note: Technically React apps can run on the server too but Create React App doesn't currently support server rendering. It also comes with many pitfalls so I recommend holding off using it until you are comfortable with React itself.

通常,使用 Create React App,您应该 运行 您的 API 服务器(可能使用 Feathers)作为节点(或任何其他)应用程序单独使用。 React 客户端将通过 AJAX 或其他网络 APIs.

访问它

您的 Node 应用程序将使用 feathers 作为服务器,而 React 应用程序将使用 feathers/client 与其通信。

要阅读有关设置 Node 和客户端 React 应用程序以相互通信的信息,请查看 this tutorial and its demo