mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-26 23:49:51 +00:00
fix: import js index file with file extension (#2206)
This commit is contained in:
@@ -39,7 +39,7 @@ export type ImportPathConfig = { relativeTo: string } | { absolute: true };
|
||||
export function toImportPath(file: string, config: ImportPathConfig): string {
|
||||
const ext = path.extname(file);
|
||||
const filename =
|
||||
ext === '.ts' ? file.substring(0, file.length - ext.length) : file;
|
||||
ext === '.ts' ? file.substring(0, file.length - ext.length) + '.js' : file;
|
||||
let importPath;
|
||||
|
||||
if ('relativeTo' in config) {
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@
|
||||
import { _runtimeAsync, buildConfig } from "fumadocs-mdx/runtime/async"
|
||||
const _sourceConfig = buildConfig(_source)
|
||||
import { _runtime } from "fumadocs-mdx"
|
||||
import * as _source from "./config"
|
||||
import * as _source from "./config.js"
|
||||
export const docs = _runtimeAsync.doc<typeof _source.docs>([{"info":{"path":"index.mdx","absolutePath":"$cwd/packages/mdx/test/fixtures/index.mdx"},"data":{},"content":"# Hello World\n"}, {"info":{"path":"folder/test.mdx","absolutePath":"$cwd/packages/mdx/test/fixtures/folder/test.mdx"},"data":{},"content":""}], "docs", _sourceConfig)
|
||||
+1
-1
@@ -2,5 +2,5 @@
|
||||
import * as docs_1 from "./folder/test.mdx?collection=docs&hash=hash"
|
||||
import * as docs_0 from "./index.mdx?collection=docs&hash=hash"
|
||||
import { _runtime } from "fumadocs-mdx"
|
||||
import * as _source from "./config"
|
||||
import * as _source from "./config.js"
|
||||
export const docs = _runtime.doc<typeof _source.docs>([{ info: {"path":"index.mdx","absolutePath":"$cwd/packages/mdx/test/fixtures/index.mdx"}, data: docs_0 }, { info: {"path":"folder/test.mdx","absolutePath":"$cwd/packages/mdx/test/fixtures/folder/test.mdx"}, data: docs_1 }]);
|
||||
Reference in New Issue
Block a user