initial commit
This commit is contained in:
59
node_modules/nuxt/dist/app/entry.mjs
generated
vendored
Normal file
59
node_modules/nuxt/dist/app/entry.mjs
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import { createSSRApp, createApp, nextTick } from "vue";
|
||||
import { $fetch } from "ofetch";
|
||||
import { baseURL } from "#build/paths.mjs";
|
||||
import { createNuxtApp, applyPlugins, normalizePlugins } from "#app";
|
||||
import "#build/css";
|
||||
import _plugins from "#build/plugins";
|
||||
import RootComponent from "#build/root-component.mjs";
|
||||
import { appRootId } from "#build/nuxt.config.mjs";
|
||||
if (!globalThis.$fetch) {
|
||||
globalThis.$fetch = $fetch.create({
|
||||
baseURL: baseURL()
|
||||
});
|
||||
}
|
||||
let entry;
|
||||
const plugins = normalizePlugins(_plugins);
|
||||
if (process.server) {
|
||||
entry = async function createNuxtAppServer(ssrContext) {
|
||||
const vueApp = createApp(RootComponent);
|
||||
const nuxt = createNuxtApp({ vueApp, ssrContext });
|
||||
try {
|
||||
await applyPlugins(nuxt, plugins);
|
||||
await nuxt.hooks.callHook("app:created", vueApp);
|
||||
} catch (err) {
|
||||
await nuxt.callHook("app:error", err);
|
||||
nuxt.payload.error = nuxt.payload.error || err;
|
||||
}
|
||||
return vueApp;
|
||||
};
|
||||
}
|
||||
if (process.client) {
|
||||
if (process.dev && import.meta.webpackHot) {
|
||||
import.meta.webpackHot.accept();
|
||||
}
|
||||
entry = async function initApp() {
|
||||
const isSSR = Boolean(window.__NUXT__?.serverRendered);
|
||||
const vueApp = isSSR ? createSSRApp(RootComponent) : createApp(RootComponent);
|
||||
const nuxt = createNuxtApp({ vueApp });
|
||||
try {
|
||||
await applyPlugins(nuxt, plugins);
|
||||
} catch (err) {
|
||||
await nuxt.callHook("app:error", err);
|
||||
nuxt.payload.error = nuxt.payload.error || err;
|
||||
}
|
||||
try {
|
||||
await nuxt.hooks.callHook("app:created", vueApp);
|
||||
await nuxt.hooks.callHook("app:beforeMount", vueApp);
|
||||
vueApp.mount("#" + appRootId);
|
||||
await nuxt.hooks.callHook("app:mounted", vueApp);
|
||||
await nextTick();
|
||||
} catch (err) {
|
||||
await nuxt.callHook("app:error", err);
|
||||
nuxt.payload.error = nuxt.payload.error || err;
|
||||
}
|
||||
};
|
||||
entry().catch((error) => {
|
||||
console.error("Error while mounting app:", error);
|
||||
});
|
||||
}
|
||||
export default (ctx) => entry(ctx);
|
||||
Reference in New Issue
Block a user