[英]react-snap no such file or directory
I have an app that works in the following way: 我有一个可以通过以下方式工作的应用程序:
/client/app/public/build
. /client/app/public/build
。 After I run yarn run build
and the postbuild
script is executed, it fails immediately with the following error: 我运行
yarn run build
并执行了postbuild
脚本后,它立即失败,并显示以下错误:
yarn run v1.9.4
$ react-snap
events.js:183
throw er; // Unhandled 'error' event
^
Error: ENOENT: no such file or directory, open '/Users/aington/git/static-help/build/index.html'
error Command failed with exit code 1.
This makes sense, since there are no files in that location. 这是有道理的,因为该位置没有文件。
I know that react-snap
prides itself on being a zero-configuration library, but I really would like to configure it so that it can point to the right directory for serving files. 我知道
react-snap
以成为零配置库而自豪,但是我真的很想对其进行配置,以便它可以指向用于提供文件的正确目录。 Additionally, the Express server provides an authentication library, so that needs to run too. 另外,Express服务器提供了一个身份验证库,因此也需要运行。
Is it realistic to expect that react-snap
can do this and still crawl and pre-render the site? 期望
react-snap
可以做到这一点并且仍然可以爬网和预渲染网站是否现实? Or should I explore other options? 还是应该探索其他选择?
Check the default options in index.js 检查index.js中的默认选项
https://github.com/stereobooster/react-snap/blob/97542b802917362773a2601f52d368c01bd5e0f7/index.js#L15 https://github.com/stereobooster/react-snap/blob/97542b802917362773a2601f52d368c01bd5e0f7/index.js#L15
and use it in package.json like the below 像下面这样在package.json中使用它
"reactSnap" : {
"source" : "./dist"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.