How can I prevent Netlify reading cached folder structure when build

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.


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.

I don’t think this is a systemic issue (strictly based on the lack of complaints we’ve seen about this exact issue). It could be something else happening, which we’re open to debug if that’s still something you wish to do.

Thanks for reply me.
We don’t have anymore issue now. If you would like us to provide anymore information, please let me know.

Maybe this is an edge case, the site was running for years. And we just change the codebase and updated folder structure.

If you can share your repo (before and after the change that you made that caused that), it would be a good starting point to start debugging.

Unfortuenetly, I can’t share the codebase due to its a client work. Hope you undertand.
With a bit more investigation, I found it might be gitlab that kept deleted file’s case.

This is one of the early commit.
AmountInput.js should be amountInput.js
TextInput.js should be textInput.js
And amountSelector.js was newly added, so it got the correct filename.

So I think its most likely to be a false alarm.