Skip to content

Commit

Permalink
feat: upload blobs on onDev event
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
ndhoule committed Mar 20, 2024
1 parent 664052b commit 2d2f1da
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/build/src/steps/get.ts
Expand Up @@ -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 }
Expand Down

0 comments on commit 2d2f1da

Please sign in to comment.