From 571c54f72a23e41ce38ca8921eaae4566896e3a2 Mon Sep 17 00:00:00 2001 From: Nathan Houle Date: Wed, 20 Mar 2024 09:12:43 -0700 Subject: [PATCH] feat: upload blobs on onDev event This changeset updates the dev timeline's steps to run the `uploadBlobs` core plugin on the `onDev` event. (It will also allow users to use file- based blobs locally using `netlify dev`, but that's an ancillary benefit.) Some background on the "why" of this issue: Frameworks has been exploring use cases that involve writing to the blobs directory (for example, a Remix site that writes an initial cache static files into the blobs directory that may later be invalidated and replaced with dynamically generated and served assets). They gave the feedback that it's difficult to test out this type of functionality locally, where `netlify dev` is their primary workflow. Fixes [CT-651](https://linear.app/netlify/issue/CT-651). --- packages/build/src/steps/get.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/build/src/steps/get.ts b/packages/build/src/steps/get.ts index 7451b76c34..0a78f89c49 100644 --- a/packages/build/src/steps/get.ts +++ b/packages/build/src/steps/get.ts @@ -39,7 +39,18 @@ export const getDevSteps = function (command, steps, eventHandlers?: any[]) { const eventSteps = getEventSteps(eventHandlers) - const sortedSteps = sortSteps([preDevCleanup, ...steps, eventSteps, devCommandStep], DEV_EVENTS) + const sortedSteps = sortSteps( + [ + preDevCleanup, + ...steps, + // Trigger the uploadBlobs step during development to allow users to test file-based blob + // uploads locally and to allow frameworks to capture file-based blobs written by frameworks + { ...uploadBlobs, event: 'onDev' }, + eventSteps, + devCommandStep, + ], + DEV_EVENTS, + ) const events = getEvents(sortedSteps) return { steps: sortedSteps, events }