-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vite): error messages when .server files are referenced by client (
- Loading branch information
Showing
5 changed files
with
308 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
"@remix-run/dev": minor | ||
--- | ||
|
||
Vite: Error messages when .server files are referenced by client | ||
|
||
Previously, referencing a `.server` module from client code resulted in an error message like: | ||
|
||
```txt | ||
The requested module '/app/models/answer.server.ts' does not provide an export named 'isDateType' | ||
``` | ||
|
||
Which was confusing because `answer.server.ts` _does_ provide the `isDateType` export, | ||
but Remix was replacing `.server` modules with empty modules (`export {}`) for the client build. | ||
|
||
Now, Remix explicitly fails at compile time when a `.server` module is referenced from client code | ||
and includes dedicated error messages depending on whether the import occurs in a route or a non-route | ||
module. The error messages also include links to relevant documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.