Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remix dev mode redirect bug when verbatimModuleSyntax is set to true #10083

Open
brookslybrand opened this issue Oct 9, 2024 · 1 comment
Open
Labels
bug Something isn't working package:dev

Comments

@brookslybrand
Copy link
Contributor

Reproduction

https://stackblitz.com/edit/remix-run-remix-e89vvn?file=tsconfig.json,app%2Froot.tsx,app%2Froutes%2Fsignup.tsx,app%2Froutes%2Fverify.tsx

System Info

latest remix packages and what not, your can see in the reproduction

Used Package Manager

npm

Expected Behavior

Redirect from an action should work as expected

Actual Behavior

This is one of the weirdest bugs I've run into. Basically if you have

// tsconfig.json
{
  "verbatimModuleSyntax": true,
}

and very specific imports setup, when you try to redirect from an action it'll cause the whole page to refresh and cancel the redirect. This isn't a problem in production, but it caused for a very difficult to track down bug in a larger app someone shared with me.

redirect-madness.mov
@brookslybrand brookslybrand added bug Something isn't working package:dev labels Oct 9, 2024
@laishere
Copy link

laishere commented Oct 10, 2024

When we open the console, it shows the ReferenceError: process is not defined error, which I believe is cause by the "verbatimModuleSyntax": true. It will break the dynamic module loading here:

export async function loadRouteModule(

Which will make the page reload as expected:

window.location.reload();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package:dev
Projects
None yet
Development

No branches or pull requests

2 participants