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
Uncaught SyntaxError: The requested module '/app/root.tsx? does not provide an export named 'Layout' (at root.tsx) #9187
Comments
Hmm... seems like something with your project, as my export function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body suppressHydrationWarning>
{children}
<ScrollRestoration />
<Scripts />
</body>
</html>
)
}
export default function App() {
return <Outlet />
}
export function ErrorBoundary() {
return <DefaultErrorBoundary />
}
export function HydrateFallback() {
return <h1>Loading...</h1>
} https://github.com/kiliman/remix-vite-template/blob/main/app/root.tsx |
Even when I revert to not using // FILE: root.tsx
import { json, LoaderFunctionArgs } from '@remix-run/node';
import { Links, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData } from '@remix-run/react';
import { Toaster } from 'react-hot-toast';
import { Icons } from './icons/Icons';
import { TopNav } from './ui-components/top-nav/TopNav';
import { getUser } from './session.server';
import { getConfigTypes } from './data-access/customizations.server';
import './tailwind.css';
export async function loader ({ request }:LoaderFunctionArgs) {
return json({ user: await getUser(request), configTypes: await getConfigTypes() });
};
export default function App() {
const data = useLoaderData<typeof loader>();
return (
<html lang="en">
<head>
<Meta />
<Links />
</head>
<body className="tw-bg-warm-gray-200">
<Icons />
<Toaster position="bottom-left" />
<TopNav user={data.user} configTypes={data.configTypes} />
<Outlet />
<ScrollRestoration />
<Scripts />
</body>
</html>
);
} Also tried making
|
Have you wiped It might be simpler to create a new app and move the app folder to it. |
I am also facing a similar issue since migrating to Vite. Uncaught SyntaxError: The requested module '/app/root.tsx' does not provide an export named 'links' (at root.tsx:245:5) As suggested above I have wiped node_modules. Issue continues @cliffordfajardo i have noticed the error seems to go if i remove the use of @babel/preset-env. Just wondered are you using this babel package? |
When filing issues, I think it's helpful if you specify any custom configuration beyond stock Remix. Without an actual repo, troubleshooting these problems is difficult. Thanks! |
@kb12abz - yeah I think that may have been it! I couldn't trace where the error was coming from & I figured that if I was on vite I could probably remove all the old babel dependencies this app was using when it was on remix using esbuild and very old versions of storybook which relied on babel. |
Its strange though; why did having babel installed effect the remix app runnning on vite? 🤔 |
@cliffordfajardo did you have a Babel config file still in the project? That can mess things up |
Description
Currently upgrading from remix on esbuild to vite and getting export errors.
My
root.tsx
file:Expected Behavior
should not warn abot missing export named
Layout
whenLayout
is exported from the root.tsx fileActual Behavior
After upgrading to remix from esbuild to vite I am getting warning errors about root.tsx:
Reproduction
Work in progress, but wanted to post this in case other folks have run into this and get conversation going
System Info
Used Package Manager
yarn
The text was updated successfully, but these errors were encountered: