Skip to content

Commit 90f39d5

Browse files
TyMickgabrielmfern
andauthored
fix(react-email): broken paths on email build output for Windows (#2475)
Co-authored-by: Gabriel Miranda <[email protected]>
1 parent ae19d38 commit 90f39d5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/plenty-wasps-walk.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+
Normalize Windows paths in generated Next.js config

packages/react-email/src/commands/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ const setNextEnvironmentVariablesForBuild = async (
7878
const nextConfigContents = `
7979
const path = require('path');
8080
const emailsDirRelativePath = path.normalize('${emailsDirRelativePath}');
81-
const userProjectLocation = '${process.cwd()}';
81+
const userProjectLocation = '${process.cwd().replace(/\\/g, '/')}';
8282
/** @type {import('next').NextConfig} */
8383
module.exports = {
8484
env: {
8585
NEXT_PUBLIC_IS_BUILDING: 'true',
8686
EMAILS_DIR_RELATIVE_PATH: emailsDirRelativePath,
8787
EMAILS_DIR_ABSOLUTE_PATH: path.resolve(userProjectLocation, emailsDirRelativePath),
88-
PREVIEW_SERVER_LOCATION: '${builtPreviewAppPath}',
88+
PREVIEW_SERVER_LOCATION: '${builtPreviewAppPath.replace(/\\/g, '/')}',
8989
USER_PROJECT_LOCATION: userProjectLocation
9090
},
9191
// this is needed so that the code for building emails works properly

0 commit comments

Comments
 (0)