Skip to content

Importing components when using SSR #180

@eabworks

Description

@eabworks

I'm not sure if this is something that works right now, but I'm having trouble getting a component to import other components when using the ssr compiler.
For reference, this is the structure of the code I'm working with in a minimal environment:
image

index.js is just this:

import { config } from "@vue-email/compiler";
const vueEmail = config("./components", {
    verbose: false,
    options: {
        // baseUrl: "https://vue-email-demo.vercel.app/",
    },
});

const html = vueEmail.render("Email.vue").then(console.log);

The setup for Email.vue looks like this:

<script setup>
import { EHtml, EHead, EBody, ETailwind } from 'vue-email';
import EApiTestWorkflowTwoTemplate from "@/components/EApiTestWorkflowTwoTemplate.vue";
</script>

Running this results in Error: Cannot find module '@/components/EApiTestWorkflowTwoTemplate.vue'.

Before trying to do this with SSR, I wanted to prove out this template within a live Vue app and I didn't have any issues like this, but the needs for our project require the SSR utility to produce the rendered html string. Is this possible right now? Am I just not understanding correctly how SSR needs imports to be defined?

This is using "^0.8.0-beta.4".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions