fix(nitro): generate correct netlify entrypoint (#372)

This commit is contained in:
Matt Kane 2021-07-26 11:37:39 +01:00 committed by GitHub
parent a57b9e1887
commit e43e9cf71a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 5 deletions

1
.gitignore vendored
View File

@ -62,3 +62,4 @@ Temporary Items
.vercel_build_output
.build-*
.env
.netlify

View File

@ -9,6 +9,7 @@ import type { NodeExternalsOptions } from './rollup/plugins/externals'
import type { StorageOptions } from './rollup/plugins/storage'
import type { AssetOptions } from './rollup/plugins/assets'
import type { ServerMiddleware } from './server/middleware'
import type { RollupConfig } from './rollup/config'
export interface NitroContext {
timing: boolean
@ -20,7 +21,7 @@ export interface NitroContext {
entry: string
node: boolean
preset: string
rollupConfig?: any
rollupConfig?: RollupConfig
renderer: string
serveStatic: boolean
middleware: ServerMiddleware[]

View File

@ -7,7 +7,7 @@ import { lambda } from './lambda'
export const netlify: NitroPreset = extendPreset(lambda, {
output: {
dir: '{{ _nuxt.rootDir }}/netlify/functions',
dir: '{{ _nuxt.rootDir }}/.netlify/functions-internal',
publicDir: '{{ _nuxt.rootDir }}/dist'
},
hooks: {
@ -24,6 +24,9 @@ export const netlify: NitroPreset = extendPreset(lambda, {
contents = currentRedirects + '\n' + contents
}
await writeFile(redirectsPath, contents)
},
'nitro:rollup:before' (ctx: NitroContext) {
ctx.rollupConfig.output.entryFileNames = 'server.ts'
}
},
ignore: [

View File

@ -1,6 +1,5 @@
// @ts-ignore
import { builderFunction } from '@netlify/functions'
import { builder } from '@netlify/functions'
// @ts-ignore
import { handler as _handler } from '#nitro/entries/lambda'
export const handler = builderFunction(_handler)
export const handler = builder(_handler)