File tree Expand file tree Collapse file tree 4 files changed +13
-8
lines changed Expand file tree Collapse file tree 4 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 1
1
import { resolve } from 'path'
2
2
3
- import { NetlifyPlugin } from '@netlify/build'
3
+ import { OnPreBuild } from '@netlify/build'
4
4
import execa from 'execa'
5
5
import { unlink , existsSync } from 'fs-extra'
6
6
7
7
import { writeDevEdgeFunction } from './edge'
8
8
import { patchNextFiles } from './files'
9
9
10
10
// The types haven't been updated yet
11
- export const onPreDev : NetlifyPlugin [ 'onPreBuild' ] = async ( { constants, netlifyConfig } ) => {
11
+ export const onPreDev : OnPreBuild = async ( { constants, netlifyConfig } ) => {
12
12
// Need to patch the files, because build might not have been run
13
13
await patchNextFiles ( resolve ( netlifyConfig . build . publish , '..' ) )
14
14
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ import {
31
31
warnForRootRedirects ,
32
32
} from './helpers/verification'
33
33
34
- const plugin : NetlifyPlugin & { onPreDev ?: OnPreBuild ; onDev ?: OnPreBuild } = {
34
+ const plugin : NetlifyPlugin = {
35
35
async onPreBuild ( {
36
36
constants,
37
37
netlifyConfig,
@@ -220,7 +220,10 @@ const plugin: NetlifyPlugin & { onPreDev?: OnPreBuild; onDev?: OnPreBuild } = {
220
220
} ,
221
221
}
222
222
// The types haven't been updated yet
223
- const nextRuntime = ( _inputs , meta : { events ?: Set < string > } = { } ) : NetlifyPlugin & { onPreDev ?: OnPreBuild } => {
223
+ const nextRuntime = (
224
+ _inputs ,
225
+ meta : { events ?: Set < string > } = { } ,
226
+ ) : NetlifyPlugin & { onPreDev ?: NetlifyPlugin [ 'onPreBuild' ] } => {
224
227
if ( ! meta ?. events ?. has ( 'onPreDev' ) ) {
225
228
return {
226
229
...plugin ,
Original file line number Diff line number Diff line change @@ -89,9 +89,11 @@ const exists = async (relativePath: string) => {
89
89
}
90
90
91
91
const handler = async ( req : Request , context : Context ) => {
92
- // if (!Deno.env.get('NETLIFY_DEV')) {
93
- // return
94
- // }
92
+ if ( ! Deno . env . get ( 'NETLIFY_DEV' ) ) {
93
+ // Only run in dev
94
+ return
95
+ }
96
+
95
97
let middleware
96
98
// Dynamic imports and FS operations aren't allowed when deployed,
97
99
// but that's fine because this is only ever used locally.
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ globalThis.NFRequestContextMap ||= new Map()
46
46
47
47
const handler = async ( req : Request , context : Context ) => {
48
48
if ( Deno . env . get ( 'NETLIFY_DEV' ) ) {
49
- console . log ( 'is dev' )
49
+ // Don't run in dev
50
50
return
51
51
}
52
52
const url = new URL ( req . url )
You can’t perform that action at this time.
0 commit comments