Open justintoman opened 6 months ago
It looks like if there's additional non-type things in the import, then the bug doesn't happen.
E.g.
import {json, type LoaderFunctionArgs} from '@remix-run/node'`;
That doesn't seem to do it. It's only when there's only type imports and they're inside the braces. I know it's potentially silly to write it that way, but this happened in my project after I refactored a route to still need LoaderFunctionArgs
but it no longer needed to import json
and redirect
.
The import used to be
import {json, redirect, type LoaderFunctionArgs} from '@remix-run/node';
And then after removing those two, it became
import {type LoaderFunctionArgs} from '@remix-run/node';
In any case, this still seems like a bug. But hopefully this will help other people that run into it.
"verbatimModuleSyntax"
type
on the outside of the braces.Supper annoying issue which for me doesn't give any errors except that route navigation doesn't work.
Reproduction
https://github.com/justintoman/remix-node-bug
Copy/pasted from the README.md in that repo 👆
npm create vite@latest
tsconfig.json
, add"verbatimModuleSyntax": true
_index.tsx
change theimport type
for the@remix-run/node
import to be inside the bracesimport type { MetaFunction } from "@remix-run/node";
import { type MetaFunction } from "@remix-run/node";
Steps to reproduce
npm install
npm run dev
System Info
Used Package Manager
npm
Expected Behavior
@remix-run/node should not make it into the code run by the browser
Actual Behavior
It does get into the browser, which causes an error when
process
doesn't exist.