From 97629591e34dde7f70fdf9ab255be7e521426397 Mon Sep 17 00:00:00 2001 From: Sefer Mirza Date: Thu, 12 Oct 2023 19:20:59 +0300 Subject: [PATCH] fix generate error --- .theme/error.vue | 18 ++++++++++++++++++ .theme/nuxt.config.ts | 7 ++++++- setup-guide.md | 10 ++++++++++ theme-legacy/app.vue | 5 ----- theme-legacy/transformers/optimus-prime.ts | 13 ------------- .../transformers/transformer-module.ts | 16 ---------------- theme-legacy/types/Demo.ts | 3 --- theme-legacy/types/index.ts | 1 - 8 files changed, 34 insertions(+), 39 deletions(-) create mode 100644 .theme/error.vue delete mode 100644 theme-legacy/app.vue delete mode 100644 theme-legacy/transformers/optimus-prime.ts delete mode 100644 theme-legacy/transformers/transformer-module.ts delete mode 100644 theme-legacy/types/Demo.ts delete mode 100644 theme-legacy/types/index.ts diff --git a/.theme/error.vue b/.theme/error.vue new file mode 100644 index 00000000..828b17f7 --- /dev/null +++ b/.theme/error.vue @@ -0,0 +1,18 @@ + + diff --git a/.theme/nuxt.config.ts b/.theme/nuxt.config.ts index 36177a22..b806caab 100644 --- a/.theme/nuxt.config.ts +++ b/.theme/nuxt.config.ts @@ -48,5 +48,10 @@ export default defineNuxtConfig({ } } }, - css: ["~/assets/styles.scss"] + css: ["~/assets/styles.scss"], + nitro: { + prerender: { + ignore: ["/demo/error/non-existent-content"] + } + } }); diff --git a/setup-guide.md b/setup-guide.md index 27140d5c..38329e9a 100644 --- a/setup-guide.md +++ b/setup-guide.md @@ -427,3 +427,13 @@ add them under `/modules`, you don't need to add those local modules to your To see the use of transformer `/transformers/optimus-prime.ts` To see how to add a module look `nuxt.config.ts`. + +### prerender fail + +After version nuxt 3.6.2, if a page corresponding to the link cannot be found, +it gives generate error. + +For solution you can make `nitro.prerender.failOnError` `false` or add path to +`nitro.prerender.ignore` array. + +See `nuxt.config.ts` for example. diff --git a/theme-legacy/app.vue b/theme-legacy/app.vue deleted file mode 100644 index b39486fb..00000000 --- a/theme-legacy/app.vue +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/theme-legacy/transformers/optimus-prime.ts b/theme-legacy/transformers/optimus-prime.ts deleted file mode 100644 index 29041d70..00000000 --- a/theme-legacy/transformers/optimus-prime.ts +++ /dev/null @@ -1,13 +0,0 @@ -// @ts-ignore -import { defineTransformer } from "@nuxt/content/transformers"; - -export default defineTransformer({ - name: "learn-transformer", - extensions: [".md"], - transform (content: any) { - if(content.title === "Transformers") { - content.body.children.filter((f: any) => f.tag === "p")[0].tag = "strong"; - } - return content; - } -}); diff --git a/theme-legacy/transformers/transformer-module.ts b/theme-legacy/transformers/transformer-module.ts deleted file mode 100644 index 25f2ec46..00000000 --- a/theme-legacy/transformers/transformer-module.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { resolve } from "path"; -import { defineNuxtModule } from "@nuxt/kit"; - -// You can check this 'https://content.nuxtjs.org/api/advanced' to -// understand how transformers are registered. -export default defineNuxtModule({ - setup (_options, nuxt) { - nuxt.options.nitro.externals ||= { }; - nuxt.options.nitro.externals.inline ||= []; - nuxt.options.nitro.externals.inline.push(resolve("./transformers")); - - nuxt.hook("content:context", contentContext => { - contentContext.transformers.push(resolve("./transformers/optimus-prime.ts")); - }); - } -}); diff --git a/theme-legacy/types/Demo.ts b/theme-legacy/types/Demo.ts deleted file mode 100644 index be696ea8..00000000 --- a/theme-legacy/types/Demo.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type Demo = { - stringProp: string -}; diff --git a/theme-legacy/types/index.ts b/theme-legacy/types/index.ts deleted file mode 100644 index f9847d39..00000000 --- a/theme-legacy/types/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./Demo";