chore(app): entry types (#345)

[skip-release]
This commit is contained in:
Daniel Roe 2021-07-20 11:20:17 +01:00 committed by GitHub
parent 19794ddd21
commit 8d3f296e40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import { createSSRApp, createApp, nextTick } from 'vue' import { createSSRApp, createApp, nextTick } from 'vue'
import { createNuxt, applyPlugins, normalizePlugins } from '@nuxt/app' import { createNuxt, applyPlugins, normalizePlugins, CreateOptions } from '@nuxt/app'
// @ts-ignore // @ts-ignore
import _plugins from '#build/plugins' import _plugins from '#build/plugins'
// @ts-ignore // @ts-ignore
@ -10,7 +10,7 @@ let entry: Function
const plugins = normalizePlugins(_plugins) const plugins = normalizePlugins(_plugins)
if (process.server) { if (process.server) {
entry = async function createNuxtAppServer (ssrContext = {}) { entry = async function createNuxtAppServer (ssrContext: CreateOptions['ssrContext'] = {}) {
const app = createApp(App) const app = createApp(App)
const nuxt = createNuxt({ app, ssrContext }) const nuxt = createNuxt({ app, ssrContext })
@ -28,6 +28,7 @@ if (process.client) {
// https://github.com/webpack-contrib/webpack-hot-middleware/issues/390 // https://github.com/webpack-contrib/webpack-hot-middleware/issues/390
// @ts-ignore // @ts-ignore
if (process.dev && import.meta.webpackHot) { if (process.dev && import.meta.webpackHot) {
// @ts-ignore
import.meta.webpackHot.accept() import.meta.webpackHot.accept()
} }
@ -53,4 +54,4 @@ if (process.client) {
}) })
} }
export default ctx => entry(ctx) export default (ctx?: CreateOptions['ssrContext']) => entry(ctx)