Skip to content
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
7 changes: 4 additions & 3 deletions packages/preview-server/src/actions/render-email-by-path.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ export const renderEmailByPath = async (
return cache.get(emailPath)!;
}

const timeBeforeEmailRendered = performance.now();

const emailFilename = path.basename(emailPath);
let spinner: Ora | undefined;
if (!isBuilding && !isPreviewDevelopment) {
Expand All @@ -61,6 +59,7 @@ export const renderEmailByPath = async (
registerSpinnerAutostopping(spinner);
}

const timeBeforeEmailBundled = performance.now();
const originalJsxRuntimePath = path.resolve(
previewServerLocation,
'jsx-runtime',
Expand All @@ -70,6 +69,7 @@ export const renderEmailByPath = async (
originalJsxRuntimePath,
);
const componentResult = await getEmailComponent(emailPath, jsxRuntimePath);
const millisecondsToBundled = performance.now() - timeBeforeEmailBundled;

if ('error' in componentResult) {
spinner?.stopAndPersist({
Expand All @@ -90,6 +90,7 @@ export const renderEmailByPath = async (
const previewProps = Email.PreviewProps || {};
const EmailComponent = Email as React.FC;
try {
const timeBeforeEmailRendered = performance.now();
const element = createElement(EmailComponent, previewProps);
const markupWithReferences = await renderWithReferences(element, {
pretty: true,
Expand Down Expand Up @@ -117,7 +118,7 @@ export const renderEmailByPath = async (
}
spinner?.stopAndPersist({
symbol: logSymbols.success,
text: `Successfully rendered ${emailFilename} in ${timeForConsole}`,
text: `Successfully rendered ${emailFilename} in ${timeForConsole} (bundled in ${millisecondsToBundled.toFixed(0)}ms)`,
});

const renderingResult: RenderedEmailMetadata = {
Expand Down
Loading