Skip to content

Commit 1e13d15

Browse files
committed
fix(react-email): broken hot reloading with non-js imports (#2572)
1 parent c4d149e commit 1e13d15

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

.changeset/fuzzy-monkeys-exist.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+
hot reloading errors when importing .json and other file extensions

packages/react-email/src/utils/preview/hot-reloading/create-dependency-graph.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,12 @@ export const createDependencyGraph = async (directory: string) => {
146146
const pathWithEnsuredExtension = (() => {
147147
if (
148148
extension.length > 0 &&
149-
javascriptExtensions.includes(extension)
149+
existsSync(pathToDependencyFromDirectory)
150150
) {
151-
if (existsSync(pathToDependencyFromDirectory)) {
152-
return pathToDependencyFromDirectory;
153-
}
154-
return checkFileExtensionsUntilItExists(
155-
pathToDependencyFromDirectory.replace(extension, ''),
156-
);
151+
return pathToDependencyFromDirectory;
157152
}
158153
return checkFileExtensionsUntilItExists(
159-
pathToDependencyFromDirectory,
154+
pathToDependencyFromDirectory.replace(extension, ''),
160155
);
161156
})();
162157

0 commit comments

Comments
 (0)