nuxt
nuxt copied to clipboard
[Nuxt] Updating from vue-emai to @vue-email/nuxt breaks email rendering
Hi,
I've recently tried to update my Nuxt app which was using the vue-email
package and the vue-email/nuxt
module to @vue-mail/nuxt
which I figure is the offical package now according to the docs.
However, this breaks rendering of email components, specifically type imports which had been no issue before.
<script setup lang="ts">
import type { IRegistration } from '~/lib/forms'
defineProps<IRegistration>()
// ...
</script>
Rendering is done server-side:
import { useCompiler } from '#vue-email'
export default defineEventHandler(async (event) => {
// getting sender, name and props from event.context ...
const body = await useCompiler('Registration.vue', { props })
await send({
from: { ...sender, name },
replyTo: { name, address: email },
subject: 'New Registration',
...body,
})
})
This fails with:
Registration
4 | import type { IRegistration } from '~/lib/forms'
5 |
6 | defineProps<IRegistration>()
| ^^^^^^^^^^^^^
7 |
8 | const has = (value: any) => !isEmpty(value)
at ScriptCompileContext.error (file:///Users/andreas/Projects/marionroehrig-nuxt3/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@vue-email/compiler/dist/index.mjs:47004:11)
at importSourceToScope (file:///Users/andreas/Projects/marionroehrig-nuxt3/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@vue-email/compiler/dist/index.mjs:47566:16)
at resolveTypeFromImport (file:///Users/andreas/Projects/marionroehrig-nuxt3/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@vue-email/compiler/dist/index.mjs:47560:23)
at innerResolveTypeReference (file:///Users/andreas/Projects/marionroehrig-nuxt3/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@vue-email/compiler/dist/index.mjs:47470:14)
at resolveTypeReference (file:///Users/andreas/Projects/marionroehrig-nuxt3/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@vue-email/compiler/dist/index.mjs:47459:36)
at innerResolveTypeElements (file:///Users/andreas/Projects/marionroehrig-nuxt3/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@vue-email/compiler/dist/index.mjs:47114:24)
at resolveTypeElements (file:///Users/andreas/Projects/marionroehrig-nuxt3/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@vue-email/compiler/dist/index.mjs:47071:35)
at resolveRuntimePropsFromType (file:///Users/andreas/Projects/marionroehrig-nuxt3/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@vue-email/compiler/dist/index.mjs:48396:20)
at genRuntimePropsFromTypes (file:///Users/andreas/Projects/marionroehrig-nuxt3/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@vue-email/compiler/dist/index.mjs:48372:17)
at genRuntimeProps (file:///Users/andreas/Projects/marionroehrig-nuxt3/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@vue-email/compiler/dist/index.mjs:48362:18)
[nuxt] [request error] [unhandled] [500] The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object
at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
at new NodeError (node:internal/errors:405:5)
at _write (node:internal/streams/writable:322:13)
at Writable.end (node:internal/streams/writable:619:17)
at Immediate.<anonymous> (./node_modules/.pnpm/[email protected]/node_modules/nodemailer/lib/mime-node/index.js:988:35)
at process.processImmediate (node:internal/timers:478:21)