在我的 Gatsby js 网站中使用 gatsby-drupal-webform 时出现此错误:
Failed to compile
GraphQL Error Unknown type "webform__webform". Did you mean "date_format__date_format"?
file: C:/xampp/htdocs/drupal-gatsby-t/node_modules/gatsby-drupal-webform/dist/Webform.jsx
1 |
> 2 | fragment Webform on webform__webform {
| ^
3 | name: drupal_internal__id
4 | description
5 | status
6 | elements {
7 | name
8 | _type
9 | _title
10 | _title_display
11 | _default_value
12 | _description
最佳答案
我是该模块的作者。这个问题中使用的软件包版本很旧,如果没有当时未发布的 Drupal hack,它就无法工作。
我建议通过运行npm install gatsby-drupal-webform@latest --save
来更新到最新版本
那么您还需要:
- 安装 Drupal module来自 Drupal 存储库。该模块将预处理 Webform jsonapi 输出并打开用于提交表单的 REST 端点。
- 让 Gatsby 访问 Drupal jsonapi,并具有
访问任何 Webform 配置
权限。这可以通过为 Drupal 和 setting username and password 安装basic_auth
模块来完成。在gatsby-source-drupal
设置中拥有该权限的用户。
您可以看看this example项目。
关于javascript - 使用 gatsby-drupal-webform 和 GraphQL 时出现错误未知类型 "webform__webform",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57988194/