This is a Build problems, however I have resolved it. But I think there are something can be improved to netlify’s functionality.
We just upgrade from gatsby-v2 to gatsby-v5, and our new project had lots of folder structure change.
e.g.
Old structure:
- src
-
- components
-
-
- inputs
-
-
-
-
- AmountInput.js
-
-
-
-
-
- SelectInput.js
-
-
-
-
-
- TextInput.js
-
-
New structrue:
- src
-
- components
-
-
- inputs
-
-
-
-
- AmountInput.js
-
-
-
-
-
- AmountSelector.js
-
-
-
-
-
- TextInput.js
-
-
However when I built with a fresh Netlify site, the build passes without any issue.
We used a new netlify site as a staging site purpose to build out this upgrade frist before roll it out to production.
And when I tried on the new site with exact setting, the build fails with the following error:
5:00:00 PM: failed Building production JavaScript and CSS bundles - 9.313s
5:00:00 PM: error Generating JavaScript bundles failed
5:00:00 PM: Can’t resolve ‘…/inputs/AmountSelector.js’ in ‘/opt/build/repo/src/components/contentfulModal’
5:00:00 PM: If you’re trying to use a package make sure that ‘…/inputs/AmountSelector.js’ is installed. If you’re trying to use a local file make sure that the path is correct.
I wasn’t able to figure the issue out, and have been blocked for few hours. During that time, I tried the “Clear cache and rebuild with the latest branch commit”. And it did not work for me.
And later on, I tried to change the folder name, from “input” to “newInput” and it just worked for me.
So I wonder, can the “folder cache” be cleared when we press “Clear cache and rebuild with the latest branch commit”? in future? Or does this get periodically cleaned in certain amount of time?
Anyway, I don’t have any immediate issue to resolve. This is just a suggestion.
