mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-29 22:02:46 -07:00
Add support for MDX (#17)
* feat: add support for MDX * fix: prevent empty server handler error message * doc: add MDX mention to README * feat: update version to v0.7.0
This commit is contained in:
@@ -46,7 +46,7 @@ async function getRouteNodes(
|
||||
|
||||
if (dirent.isDirectory()) {
|
||||
await recurse(relativePath)
|
||||
} else if (fullPath.match(/\.(tsx|ts|jsx|js)$/)) {
|
||||
} else if (fullPath.match(/\.(tsx|ts|jsx|js|mdx)$/)) {
|
||||
const filePath = replaceBackslash(path.join(dir, dirent.name))
|
||||
const filePathNoExt = removeExt(filePath)
|
||||
let routePath =
|
||||
@@ -220,6 +220,7 @@ export async function routeGenerator(config = defaultConfig): Promise<void> {
|
||||
|
||||
const imports = [
|
||||
...sortedRouteNodes.map((node) => {
|
||||
const extension = node.filePath.endsWith('mdx') ? '.mdx' : ''
|
||||
return `const ${
|
||||
node.variableName
|
||||
}Import = dynamic(() => import('./${replaceBackslash(
|
||||
@@ -230,7 +231,7 @@ export async function routeGenerator(config = defaultConfig): Promise<void> {
|
||||
),
|
||||
false,
|
||||
),
|
||||
)}'))`
|
||||
)}${extension}'))`
|
||||
}),
|
||||
].join('\n')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user