shellscape / jsx-email

Build emails with a delightful DX
https://jsx.email
MIT License
895 stars 28 forks source link

Broken build process on Windows #194

Closed thomasdondorf closed 1 month ago

thomasdondorf commented 1 month ago

Windows OS:

npm create jsx-email
npm run build # which will run: email build ./templates

Expected Behavior

The templates are built.

Actual Behavior

The following error:

> test-email-project@0.0.0 build
> email build ./templates

Found 1 files:
   templates/email.tsx

Starting build...
Error: ENOENT: no such file or directory, mkdir 'D:\test-email-project\.rendered\C:\Users\Thomas\AppData\Local\Temp\jsx-email\1715164138117'

Additional Information

I investigated the problem and the problem is in this line: https://github.com/shellscape/jsx-email/blob/f77ece7dcc834db4699247a189e5ccbe091347c7/packages/jsx-email/src/cli/commands/build.ts#L105

The call path.replace(outputBasePath, '') uses the following variables with the content:

So it looks like outputBasePath was run through path.resolve somewhere (turning / into \ on Windows) while path was not. Therefore, path.replace(outputBasePath, "") does nothing as the separators are different...

A fix would be to run the variable path through resolve to fix the separators.