【发布时间】:2019-11-03 20:09:22
【问题描述】:
我正在使用 Angular Universal 设置一个 Angular 8 项目,以使我的项目对 SEO 更友好。我的实际阻止程序是当我想运行npm run server:ssr 时抛出与@firebase/app package 相关的错误。
我在 Windows 10 机器 Angular 8 和 Firebase ^6.2.0 上运行该项目
angular.json 文件:
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json"
},
这是我收到的消息:
@firebase/app:
Warning: This is a browser-targeted Firebase bundle but it appears it is being
run in a Node environment. If running in a Node environment, make sure you
are using the bundle specified by the "main" field in package.json.
If you are using Webpack, you can specify "main" as the first item in
"resolve.mainFields":
https://webpack.js.org/configuration/resolve/#resolvemainfields
If using Rollup, use the rollup-plugin-node-resolve plugin and specify "main"
as the first item in "mainFields", e.g. ['main', 'module'].
https://github.com/rollup/rollup-plugin-node-resolve
【问题讨论】:
标签: node.js angular firebase angularfire server-side-rendering