gatsby - 增量构建 Netlify + Gatsby 不工作
问题描述
我一直在尝试使用增量构建来设置 Gatsby + Netlify,但我无法让它工作。盖茨比一直认为每一页都需要更新。有谁知道我能做什么?
查看日志。我使用 Gatsby 缓存,但它会更新我没有接触过的页面。
PM:
12:08:07 PM: ❯ Loading plugins
12:08:07 PM: - netlify-plugin-gatsby-cache@0.2.2 from netlify.toml and package.json
12:08:08 PM:
12:08:08 PM: ┌────────────────────────────────────────────────────────┐
12:08:08 PM: │ 1. onPreBuild command from netlify-plugin-gatsby-cache │
12:08:08 PM: └────────────────────────────────────────────────────────┘
12:08:08 PM:
12:08:11 PM: Found a Gatsby cache. We’re about to go FAST. ⚡️
12:08:11 PM:
12:08:11 PM: (netlify-plugin-gatsby-cache onPreBuild completed in 3.2s)
12:08:11 PM:
12:08:11 PM: ┌────────────────────────────────────┐
12:08:11 PM: │ 2. build.command from netlify.toml │
12:08:11 PM: └────────────────────────────────────┘
12:08:11 PM:
12:08:11 PM: $ npm run build
12:08:11 PM: > gatsby-starter-default@0.1.0 build /opt/build/repo
12:08:11 PM: > GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages
12:08:14 PM: success open and validate gatsby-configs - 0.063s
12:08:18 PM: success load plugins - 4.496s
12:10:15 PM: Updated page: /companies/helse-bemanning/
12:10:15 PM: Updated page: /companies/helse-bemanning/lon/
12:10:15 PM: Updated page: /companies/helse-bemanning/recensioner/
12:10:15 PM: Updated page: /companies/helse-bemanning/jobb/
12:10:15 PM: Updated page: /companies/annsam/
12:10:15 PM: Updated page: /companies/annsam/lon/
12:10:15 PM: Updated page: /companies/annsam/recensioner/
12:10:15 PM: Updated page: /companies/annsam/jobb/
12:10:15 PM: Updated page: /companies/medicarrera/
12:10:15 PM: Updated page: /companies/medicarrera/lon/
12:10:15 PM: Updated page: /companies/medicarrera/recensioner/
12:10:15 PM: Updated page: /companies/medicarrera/jobb/
12:10:15 PM: Updated page: /companies/coliva/
12:10:15 PM: Updated page: /companies/coliva/lon/
12:10:15 PM: Updated page: /companies/coliva/recensioner/
12:10:15 PM: Updated page: /companies/coliva/jobb/
12:10:15 PM: Updated page: /companies/vacant/
12:10:15 PM: Updated page: /companies/vacant/lon/
12:10:15 PM: Updated page: /companies/vacant/recensioner/
解决方案
在你的根项目傻瓜创建一个文件命名netlify.toml
为以下内容:
[[plugins]]
package = "netlify-plugin-gatsby-cache"
而已。您不需要设置任何命令左右,Gatsby + Netlify 将完成其余的工作。您的下一次部署:
9:49:34 PM: ┌────────────────────────────────────────────────────────┐
9:49:34 PM: │ 1. onPreBuild command from netlify-plugin-gatsby-cache │
9:49:34 PM: └────────────────────────────────────────────────────────┘
9:49:34 PM:
9:49:36 PM: Found a Gatsby cache. We’re about to go FAST. ⚡️
9:49:36 PM:
9:49:36 PM: (netlify-plugin-gatsby-cache onPreBuild completed in 1.7s)
推荐阅读
- typescript - 如何有条件地设置可选属性
- angular - 如何使用 [innerHtml] Angular 2 绑定到样式属性?
- regex - 如何在点之前只匹配 2 位数字,在点之后只匹配一位或两位数字
- heroku - 如果我在 Heroku 上拥有超过 5 个应用程序,我需要付费吗?
- javascript - 如何使用委托从本地存储中删除项目?
- reactjs - 数据数组更改时 Select2 不更新
- c# - 突出显示具有空字符串属性的行
- android - ARCore SceneForm HDR 房间图像
- git - IntelliJ Idea 因“Git Pull 失败”而失败。权限被拒绝(公钥)。在拉动过程中
- javascript - 角度检查滚动是手动触发还是从脚本触发