Skip to content

Commit ea579b5

Browse files
Console out build error (#2188)
Co-authored-by: gabriel miranda <gabrielmfern@outlook.com>
1 parent a9bbaec commit ea579b5

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

.changeset/tiny-bears-train.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-email": patch
3+
---
4+
5+
Log out errors that happen when `export`'s esbuild fails

packages/react-email/src/cli/commands/export.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,27 @@ export const exportTemplates = async (
7373
await build({
7474
bundle: true,
7575
entryPoints: allTemplates,
76-
plugins: [renderingUtilitiesExporter(allTemplates)],
77-
platform: 'node',
7876
format: 'cjs',
77+
jsx: 'transform',
7978
loader: { '.js': 'jsx' },
79+
logLevel: 'silent',
8080
outExtension: { '.js': '.cjs' },
81-
jsx: 'transform',
82-
write: true,
8381
outdir: pathToWhereEmailMarkupShouldBeDumped,
82+
platform: 'node',
83+
plugins: [renderingUtilitiesExporter(allTemplates)],
84+
write: true,
8485
});
8586
} catch (exception) {
86-
const buildFailure = exception as BuildFailure;
8787
if (spinner) {
8888
spinner.stopAndPersist({
8989
symbol: logSymbols.error,
9090
text: 'Failed to build emails',
9191
});
9292
}
93+
94+
const buildFailure = exception as BuildFailure;
95+
console.error(`\n${buildFailure.message}`);
96+
9397
process.exit(1);
9498
}
9599

0 commit comments

Comments
 (0)