Инкрементальные сборки Netlify + Gatsby не работают - PullRequest
1 голос
/ 08 июля 2020

Я пытался настроить 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/

1 Ответ

1 голос
/ 08 июля 2020

В вашем проекте root создайте файл с именем netlify.toml со следующим содержимым:

[[plugins]]
    package = "netlify-plugin-gatsby-cache"

Затем в Netlify установите плагин: Страница плагина Netlify

Вот и все. Вам не нужно устанавливать какую-либо команду, все остальное сделает 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)
...