Skip to content

Commit eb7f0ac

Browse files
authored
fix(react-email): next import breaking when done a second time (#2360)
1 parent 4a9cd8d commit eb7f0ac

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.changeset/every-masks-create.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-email": patch
3+
---
4+
5+
dev server erroring when trying to startup with port already being used

packages/react-email/src/utils/preview/start-dev-server.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ export const startDevServer = async (
4343
const previewServerLocation = await getPreviewServerLocation();
4444
const previewServer = createJiti(previewServerLocation);
4545

46-
const { default: next } =
47-
await previewServer.import<typeof import('next')>('next');
48-
4946
devServer = http.createServer((req, res) => {
5047
if (!req.url) {
5148
res.end(404);
@@ -137,6 +134,13 @@ export const startDevServer = async (
137134
),
138135
};
139136

137+
const next = await previewServer.import<typeof import('next')['default']>(
138+
'next',
139+
{
140+
default: true,
141+
},
142+
);
143+
140144
const app = next({
141145
// passing in env here does not get the environment variables there
142146
dev: false,

0 commit comments

Comments
 (0)