Skip to content

Commit f13ce70

Browse files
committed
fix issue where placing links in gatsby mode would break app in prod mode
1 parent 08454f4 commit f13ce70

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/src/helperFunctions/generateCode.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ const generateUnformattedCode = (
121121
if (projectType === 'Next.js') {
122122
return `<div><Link href="/${child.name}"><a>${child.name}</a></Link></div>`
123123
} else if (projectType === 'Gatsby.js') {
124-
return `<div><Link to="/${child.name}">${child.name}</Link>`
124+
return `<div><Link to="/${child.name}">${child.name}</Link></div>`
125+
// return `<div><Link href="/${child.name}"><a>${child.name}</a></Link></div>`
125126
} else return `<div><a>${child.name}</a></div>`
126127
}
127128
})
@@ -236,10 +237,9 @@ const generateUnformattedCode = (
236237
} else {
237238
return `
238239
import React, { useState } from 'react';
240+
${importsMapped}
239241
import { StaticQuery, graphql } from 'gatsby';
240242
${links ? `import { Link } from 'gatsby'` : ``}
241-
242-
${importsMapped}
243243
244244
245245
const ${currentComponent.name} = (props): JSX.Element => {

0 commit comments

Comments
 (0)