Repository navigation
Replies: 2 comments 1 reply
|
If I'm not wrong, import { default } from "package"And the second like: import default from "package"This is probably the reason why your code only works when using |
|
The issue you are seeing is not because The actual breakdown happens inside React Router v7's build compiler ( Root Cause DiagnosisReact Router v7 uses two internal Vite AST transforms on route modules:
Solution 1: Use a Thin Route Proxy File (Recommended & Idiomatic)In ReScript projects interacting with frameworks like React Router, Next.js, or Remix, the most robust and standard pattern is to keep your ReScript module pure ( // app/routes/about.js
export { loader, default } from "./About.bs.js";Why this is the best approach:
Solution 2: Fix the Custom Vite Plugin with
|
Uh oh!
There was an error while loading. Please reload this page.
I am using ReScript to write SSR mode for React Router v7, but the code is not running correctly. The compiled code is as follows.
It works fine when changed to
export default. The modified code is as follows.Is there a better way to solve this issue? I noticed that it works fine without using the loader.
I am currently trying to write a Vite plugin to solve this issue temporarily. However, I am looking for a better solution.
All reactions