MDX: fix Webpack warnings

This commit is contained in:
Fuma Nama
2025-11-18 21:12:07 +08:00
parent c3b8474687
commit f362ea1cac
5 changed files with 10 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-mdx': patch
---
Fix Webpack warnings (they require absolute paths for dependencies)
+2 -2
View File
@@ -44,7 +44,7 @@ export function createMDX(createOptions: CreateMDXOptions = {}) {
return (nextConfig: NextConfig = {}): NextConfig => {
const loaderOptions: WebpackLoaderOptions = {
...core.getOptions(),
compiledConfigPath: core.getCompiledConfigPath(),
absoluteCompiledConfigPath: path.resolve(core.getCompiledConfigPath()),
isDev,
};
@@ -105,8 +105,8 @@ export function createMDX(createOptions: CreateMDXOptions = {}) {
},
{
test: metaLoaderGlob,
enforce: 'pre',
use: [
options.defaultLoaders.babel,
{
loader: 'fumadocs-mdx/loader-meta',
options: loaderOptions,
+1 -1
View File
@@ -1,7 +1,7 @@
import { type Core, type CoreOptions, createCore } from '@/core';
export interface WebpackLoaderOptions extends CoreOptions {
compiledConfigPath: string;
absoluteCompiledConfigPath: string;
isDev: boolean;
}
+1 -1
View File
@@ -13,7 +13,7 @@ export default async function loader(
): Promise<void> {
const options = this.getOptions();
this.cacheable(true);
this.addDependency(options.compiledConfigPath);
this.addDependency(options.absoluteCompiledConfigPath);
if (!instance) {
instance = toWebpack(
+1 -1
View File
@@ -13,7 +13,7 @@ export default async function loader(
): Promise<void> {
const options = this.getOptions();
this.cacheable(true);
this.addDependency(options.compiledConfigPath);
this.addDependency(options.absoluteCompiledConfigPath);
if (!instance) {
instance = toWebpack(