au build 抱怨找不到或无法访问文件

au build complains about file not found or accessible

我已经通过 au install apollo-client 添加了 apollo-client,现在当我 运行 au build 我收到一堆 'file not found' 消息:

Tracing apollo-client...
 ------- File not found or not accessible ------
| Location: /some/path/Client/src/whatwg-fetch.js
| Requested by: /some/path/Client/node_modules/apollo-client/apollo.umd.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package
 -----------------------------------------------
 ------- File not found or not accessible ------
| Location: /some/path/Client/src/graphql/language/printer.js
| Requested by: /some/path/Client/node_modules/apollo-client/apollo.umd.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package
 -----------------------------------------------
 ------- File not found or not accessible ------
| Location: /some/path/Client/src/redux.js
| Requested by: /some/path/Client/node_modules/apollo-client/apollo.umd.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package
 -----------------------------------------------
 ------- File not found or not accessible ------
| Location: /some/path/Client/src/graphql-anywhere.js
| Requested by: /some/path/Client/node_modules/apollo-client/apollo.umd.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package
 -----------------------------------------------
 ------- File not found or not accessible ------
| Location: /some/path/Client/src/symbol-observable.js
| Requested by: /some/path/Client/node_modules/apollo-client/apollo.umd.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package
 -----------------------------------------------
 ------- File not found or not accessible ------
| Location: /some/path/Client/src/apollo-link-core.js
| Requested by: /some/path/Client/node_modules/apollo-client/apollo.umd.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package
 -----------------------------------------------
 ------- File not found or not accessible ------
| Location: /some/path/Client/src/whatwg-fetch.js
| Requested by: /some/path/Client/node_modules/apollo-client/apollo.umd.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package
 -----------------------------------------------
 ------- File not found or not accessible ------
| Location: /some/path/Client/src/graphql/language/printer.js
| Requested by: /some/path/Client/node_modules/apollo-client/apollo.umd.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package
 -----------------------------------------------
 ------- File not found or not accessible ------
| Location: /some/path/Client/src/redux.js
| Requested by: /some/path/Client/node_modules/apollo-client/apollo.umd.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package
 -----------------------------------------------
 ------- File not found or not accessible ------
| Location: /some/path/Client/src/graphql-anywhere.js
| Requested by: /some/path/Client/node_modules/apollo-client/apollo.umd.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package
 -----------------------------------------------
 ------- File not found or not accessible ------
| Location: /some/path/Client/src/symbol-observable.js
| Requested by: /some/path/Client/node_modules/apollo-client/apollo.umd.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package
 -----------------------------------------------
 ------- File not found or not accessible ------
| Location: /some/path/Client/src/apollo-link-core.js
| Requested by: /some/path/Client/node_modules/apollo-client/apollo.umd.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package
 -----------------------------------------------
Tracing whatwg-fetch...
Tracing graphql/language/printer...
Tracing redux...
Tracing graphql-anywhere...
Tracing symbol-observable...
Tracing apollo-link-core...
Tracing core-js...

知道为什么会这样吗?

是的,这是目前令我们的 CLI 感到头疼的事情之一。如果您安装的依赖项本身具有依赖项,则必须确保更新 aurelia.json 文件以将所有这些依赖项也包含在您的 vendor-bundle 中。 CLI 团队已意识到此问题并正在努力解决此痛点。

他们知道了,因为我对此抱怨不断。我很会抱怨。

更新 2018-01-18

CLI 现在有 au install 将安装依赖项,然后尝试在您的 aurelia.json 文件中正确设置它。

在使用我们的 CLI 创建新项目时,您可以通过切换到使用 Webpack 作为模块 loader/bundler 来完全避免这些问题。你将不得不选择创建一个 "Custom" 构建,但我最近搬过来了,我不得不说使用 Aurelia CLI 时的 Webpack 体验非常好。