May 23, 2023
0
Level 2
Inertia SSR + MaterialUI - Unsupported dir import
Hello, I am trying to set up my Laravel 9 project for SSR.
I have built my assets, and I'm running the SSR server using artisan inertia:start-ssr.
However, when I access my home page, I get this error on the terminal: Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/var/www/html/node_modules/@mui/material/TextField'
I am importing my MaterialUI components the way they suggest on MUI's docs:
import Typography from '@mui/material/Typography
Here is my ssr.jsx:
import ReactDOMServer from 'react-dom/server';
import { createInertiaApp } from '@inertiajs/react'
import createServer from '@inertiajs/react/server'
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import route from '../../vendor/tightenco/ziggy/dist/index.m';
const appName = "My app"
const appDescription = 'My description'
createServer((page) =>
createInertiaApp({
page,
render: ReactDOMServer.renderToString,
title: (title) => title ? `${title} | ${appName} ` : `${appName} | ${appDescription}`,
resolve: (name) => resolvePageComponent(`./Pages/${name}.jsx`, import.meta.glob('./Pages/**/*.jsx')),
setup: ({ App, props }) => {
global.route = (name, params, absolute) =>
route(name, params, absolute, {
...page.props.ziggy,
location: new URL(page.props.ziggy.location),
});
return <App {...props} />;
},
progress: {
color: '#4B5563',
},
})
)
Please or to participate in this conversation.