Error on creating Pages on the build command #27295
-
DescriptionMy build not is created with error in creating pages. I use Gatsby with TypeScript. My pages are created inside the pages folder with the Steps to reproduceRun Expected resultBuild my sites page Actual result
Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
It would help if you could provide a minimal reproduction. Have you imported react into the file? |
Beta Was this translation helpful? Give feedback.
-
Yes, I imported React into the file. Currently, my file looks like this: import React from 'react'
// Here I importing some components to the page
const IndexPage = () => (
<div>Index Page</div>
);
export default IndexPage (I just removed some components that would not help in the example) However, even with this simple example, the error occurred. I went back to a previous branch where I hadn't switched to TypeScript yet and the build happens. I'm thinking it might be something with the integration of Gatsby with TypeScript |
Beta Was this translation helpful? Give feedback.
-
I've create a repo that works; hopefully you can see any differences: https://github.com/herecydev/gatsby-starter |
Beta Was this translation helpful? Give feedback.
-
Thanks @herecydev I'll look at this example and see what may be different about my project. I'll be back soon with feedback. |
Beta Was this translation helpful? Give feedback.
-
@herecydev I found the build problem. I created some partials of my pages inside the pages folder, with the following path The solution I saw is to put an underscore before the file names, correct? In the |
Beta Was this translation helpful? Give feedback.
-
Not sure, sounds like something I wouldn't recommend anyway. |
Beta Was this translation helpful? Give feedback.
-
@williamcosta maybe you could post the repository with the site so we can be of better service? It's a bit difficult to help when we don't see the code. |
Beta Was this translation helpful? Give feedback.
-
I will review how to do this, thank you @herecydev @pvdz I will not be able to put the repository here as it is a private project of the company. But we have already discovered what the error was. |
Beta Was this translation helpful? Give feedback.
@herecydev I found the build problem. I created some partials of my pages inside the pages folder, with the following path
./src/pages/partials/[partial_name]/index.tsx
in the build I was trying to create pages from these partials as well.The solution I saw is to put an underscore before the file names, correct?
In the
npm run start
the file names without underscore working, but innpm run build
not working and cause a error build.