File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
packages/react-email/src/cli/commands Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " react-email " : patch
3
+ ---
4
+
5
+ fix improper ` require ` in ` email export `
Original file line number Diff line number Diff line change 1
1
import fs , { unlinkSync , writeFileSync } from 'node:fs' ;
2
+ import { createRequire } from 'node:module' ;
2
3
import path from 'node:path' ;
4
+ import url from 'node:url' ;
3
5
import type { Options } from '@react-email/components' ;
4
6
import { type BuildFailure , build } from 'esbuild' ;
5
7
import { glob } from 'glob' ;
@@ -32,6 +34,10 @@ type ExportTemplatesOptions = Options & {
32
34
pretty ?: boolean ;
33
35
} ;
34
36
37
+ const filename = url . fileURLToPath ( import . meta. url ) ;
38
+
39
+ const require = createRequire ( filename ) ;
40
+
35
41
/*
36
42
This first builds all the templates using esbuild and then puts the output in the `.js`
37
43
files. Then these `.js` files are imported dynamically and rendered to `.html` files
You can’t perform that action at this time.
0 commit comments