Next.js Discord

Discord Forum

Global CSS import error

Unanswered
Downy Woodpecker posted this in #help-forum
Open in Discord
Downy WoodpeckerOP
Everything worked fine until ive updated my dependencies


@emotion/styled ^11.14.0 → ^11.14.1
@mui/icons-material ^7.1.1 → ^7.2.0
@mui/material ^7.1.1 → ^7.2.0
@mui/x-charts ^8.5.2 → ^8.9.0
@mui/x-charts-pro ^8.5.2 → ^8.9.0
@mui/x-date-pickers ^8.5.2 → ^8.9.0
@mui/x-date-pickers-pro ^8.5.2 → ^8.9.0
@mui/x-license ^8.5.2 → ^8.9.0
@types/node ^24.0.3 → ^24.1.0
dotenv-cli ^8.0.0 → ^9.0.0
eslint-config-next 15.3.3 → 15.4.4
i18next ^25.2.1 → ^25.3.2
next 15.3.3 → 15.4.4
npm-check-updates ^18.0.1 → ^18.0.2
react ^19.1.0 → ^19.1.1
react-dom ^19.1.0 → ^19.1.1
react-i18next ^15.5.3 → ^15.6.1
swr ^2.3.3 → ^2.3.4

as you can see im already importing in my _app.tsx
I dont understand why this fails

4 Replies

Downy WoodpeckerOP
import '@/styles/globals.css'
import dynamic from 'next/dynamic'
import type {NextPage} from "next";
import type {ReactElement, ReactNode} from "react";
import type {AppProps} from "next/app";
import {ThemeContext} from "$components/App";
export type NextPageWithLayout<P = object, IP = P> = NextPage<P, IP> & {
    getLayout?: (page: ReactElement) => ReactNode
};

type AppPropsWithLayout = AppProps & {
    Component: NextPageWithLayout;
};

export {ThemeContext};
const App = dynamic(() => import('../components/App'), { ssr: false })
export default function MyApp({...props}: AppPropsWithLayout) {
    return <App {...props} />
}
American black bear
why are you dynamically importing your root layout?
Downy WoodpeckerOP
cause I dont want SSR