File tree 2 files changed +20
-5
lines changed
2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -123,12 +123,20 @@ const writeEdgeFunction = async ({
123
123
}
124
124
}
125
125
126
+ type NetlifyPluginConstantsWithEdgeFunctions = NetlifyPluginConstants & {
127
+ // Until https://github.com/netlify/build/pull/4481 lands
128
+ INTERNAL_EDGE_FUNCTIONS_SRC ?: string
129
+ }
130
+
131
+ export const cleanupEdgeFunctions = async ( {
132
+ INTERNAL_EDGE_FUNCTIONS_SRC = '.netlify/edge-functions' ,
133
+ } : NetlifyPluginConstantsWithEdgeFunctions ) => {
134
+ await emptyDir ( INTERNAL_EDGE_FUNCTIONS_SRC )
135
+ }
136
+
126
137
export const writeDevEdgeFunction = async ( {
127
138
INTERNAL_EDGE_FUNCTIONS_SRC = '.netlify/edge-functions' ,
128
- } : NetlifyPluginConstants & {
129
- // The constants type needs an update
130
- INTERNAL_EDGE_FUNCTIONS_SRC ?: string
131
- } ) => {
139
+ } : NetlifyPluginConstantsWithEdgeFunctions ) => {
132
140
const manifest : FunctionManifest = {
133
141
functions : [
134
142
{
Original file line number Diff line number Diff line change @@ -16,7 +16,12 @@ import {
16
16
generateCustomHeaders ,
17
17
} from './helpers/config'
18
18
import { onPreDev } from './helpers/dev'
19
- import { enableEdgeInNextConfig , writeEdgeFunctions , loadMiddlewareManifest } from './helpers/edge'
19
+ import {
20
+ enableEdgeInNextConfig ,
21
+ writeEdgeFunctions ,
22
+ loadMiddlewareManifest ,
23
+ cleanupEdgeFunctions ,
24
+ } from './helpers/edge'
20
25
import { moveStaticPages , movePublicFiles , patchNextFiles } from './helpers/files'
21
26
import { generateFunctions , setupImageFunction , generatePagesResolver } from './helpers/functions'
22
27
import { generateRedirects , generateStaticRedirects } from './helpers/redirects'
@@ -81,6 +86,8 @@ const plugin: NetlifyPlugin = {
81
86
} ,
82
87
)
83
88
89
+ await cleanupEdgeFunctions ( constants )
90
+
84
91
const middlewareManifest = await loadMiddlewareManifest ( netlifyConfig )
85
92
86
93
let usingEdge = false
You can’t perform that action at this time.
0 commit comments