Skip to content

Commit 3749c3c

Browse files
mrstorkpieh
andauthoredApr 25, 2024
fix: remove blob folder in pre-dev (#430)
* fix: remove blob folder in pre-dev * fix: no need to resolve from package path twice Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com> --------- Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
1 parent d9c97a1 commit 3749c3c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎src/index.ts

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { rm } from 'fs/promises'
2+
13
import type { NetlifyPluginOptions } from '@netlify/build'
24
import { trace } from '@opentelemetry/api'
35
import { wrapTracer } from '@opentelemetry/api/experimental'
@@ -23,6 +25,15 @@ import {
2325

2426
const tracer = wrapTracer(trace.getTracer('Next.js runtime'))
2527

28+
export const onPreDev = async (options: NetlifyPluginOptions) => {
29+
await tracer.withActiveSpan('onPreDev', async () => {
30+
const context = new PluginContext(options)
31+
32+
// Blob files left over from `ntl build` interfere with `ntl dev` when working with regional blobs
33+
await rm(context.blobDir, { recursive: true, force: true })
34+
})
35+
}
36+
2637
export const onPreBuild = async (options: NetlifyPluginOptions) => {
2738
await tracer.withActiveSpan('onPreBuild', async () => {
2839
// Enable Next.js standalone mode at build time

0 commit comments

Comments
 (0)
Please sign in to comment.