layout.tsx does not match the required types of a Next.js Layout
Unanswered
Μοχάμεντ posted this in #help-forum
ΜοχάμεντOP
Using Fumadocs and i keep getting this error
(prolly a dumb issue cuz am ed)
@Zack-911 ➜ /workspaces/Chronium-Website (main) $ npm run build
> KikoSan-Website@0.0.0 build
> next build
▲ Next.js 15.1.5
Creating an optimized production build ...
(node:20195) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Failed to compile.
./lib/source.ts
Module not found: Can't resolve '../.source'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./app/api/search/route.ts
> Build failed because of webpack errors I dont get this error in dev mode and I cant seem to fix it.(prolly a dumb issue cuz am ed)
40 Replies
ΜοχάμεντOP
source.ts in lib
import { docs, meta } from '../.source';
import { createMDXSource } from 'fumadocs-mdx';
import { loader } from 'fumadocs-core/source';
export const source = loader({
baseUrl: '/docs',
source: createMDXSource(docs, meta),
});ΜοχάμεντOP
my other website using fumadocs was working yesterday too
i added 1 more file now it wont work either
mdx file in /contents
ΜοχάμεντOP
Bump
ΜοχάμεντOP
@Μοχάμεντ source.ts in lib ts
import { docs, meta } from '../.source';
import { createMDXSource } from 'fumadocs-mdx';
import { loader } from 'fumadocs-core/source';
export const source = loader({
baseUrl: '/docs',
source: createMDXSource(docs, meta),
});
Sun bear
Where are
docs and meta in your .source folder?ΜοχάμεντOP
they are in source.config.mjs and index.d.ts
they are auto generated by fumadocs
i also started having this problem with other projects
even if i didnt edit them
where do i make hellosurce.docs
Sun bear
import sourceconfig from "../.source";
import { createMDXSource } from "fumadocs-mdx";
import { loader } from "fumadocs-core/source";
export const source = loader({
baseUrl: "/docs",
source: createMDXSource(sourceconfig.docs, sourceconfig.meta),
});@Μοχάμεντ
Maybe I'm talking nonsense, but give it a try.
Maybe I'm talking nonsense, but give it a try.
sometimes, files starting with . are ignored in prod mode. Had an issue like that, make sure it's not ignored
Sun bear
It's possible, I just read that somewhere too.
./lib/source.ts
Module not found: Can't resolve '../.source'
Module not found: Can't resolve '../.source'
lemme save this and try making a new fumadocs app
ΜοχάμεντOP
index.js isnt generated for me
on the project
the new one has a index.js in .source
could that be a problem?
yep and now the docs work
ΜοχάμεντOP
app/(home)/layout.tsx
Type error: Layout "app/(home)/layout.tsx" does not match the required types of a Next.js Layout.
"baseOptions" is not a valid Layout export field.
Static worker exited with code: 1 and signal: nullimport type { ReactNode } from 'react';
import { HomeLayout } from 'fumadocs-ui/layouts/home';
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
import { Banner } from 'fumadocs-ui/components/banner';
export const baseOptions: BaseLayoutProps = {
disableThemeSwitch: true,
githubUrl: 'https://github.com/weforge/chronium',
nav: {
title: 'Chronium',
transparentMode: 'always',
},
links: [
{
text: 'Documentation',
url: '/docs',
active: 'nested-url',
},
],
};
export default function Layout({ children }: { children: ReactNode }) {
return <>
<Banner id="hello-world">Chronium Is Under Development!</Banner>
<HomeLayout {...baseOptions}>{children}</HomeLayout>
</>;
}ΜοχάμεντOP
Bump
ΜοχάμεντOP
**
ΜοχάμεντOP
fixed