Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix(nuxt): lazy load and tree-shake error templates #5930

Merged
merged 7 commits into from
Jul 15, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/nuxt/src/app/components/nuxt-error-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<script setup>
import Error404 from '@nuxt/ui-templates/templates/error-404.vue'
import Error500 from '@nuxt/ui-templates/templates/error-500.vue'
import ErrorDev from '@nuxt/ui-templates/templates/error-dev.vue'

const props = defineProps({
error: Object
Expand Down Expand Up @@ -38,5 +37,5 @@ const statusMessage = error.statusMessage ?? (is404 ? 'Page Not Found' : 'Intern
const description = error.message || error.toString()
const stack = process.dev && !is404 ? error.description || `<pre>${stacktrace}</pre>` : undefined

const ErrorTemplate = is404 ? Error404 : process.dev ? ErrorDev : Error500
const ErrorTemplate = is404 ? Error404 : process.dev ? await import('@nuxt/ui-templates/templates/error-dev.vue').then(r => r.default || r) : Error500
pi0 marked this conversation as resolved.
Show resolved Hide resolved
danielroe marked this conversation as resolved.
Show resolved Hide resolved
</script>