So my react app is working perfectly in the beginning. I re-organized the folder structures and renamed some files to make it more clean. Afterwards, it now works perfectly in localhost but when I try to build it in AWS I got the error:
yarn run v1.22.15 $ react-scripts build && aws s3 sync build/ s3://$FRONTEND_S3 && aws cloudfront create-invalidation --distribution-id $CF_DIST_ID --paths '/*' Creating an optimized production build...
Failed to compile. ./src/components/reports/inventoryVarianceSummary/accounts/InventoryVarianceAccountStores.js Cannot find file '../../../modal/inventoryVarianceSummary/ExportTableAccountStores' in './src/components/reports/inventoryVarianceSummary/accounts'.
error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I tried to do npm run build on my pc then it showed the error
frontend@0.1.0 build react-scripts build
Creating an optimized production build... Failed to compile.
src\components\reports\inventoryVarianceSummary\accounts\InventoryVarianceAccountStores.js Line 268:14: 'ExportTableClassificationStores' is not defined react/jsx-no-undef
Search for the keywords to learn more about each error.
Those files are one of the files I moved/renamed and now it shows error. I double-checked the file path and it is correct. The app loads perfectly in localhost:3000.
Another weird thing is that the ExportTableClassificationStores that shows on npm run build is ExportTableAccountStores when I navigate to the given line. So it looked like it was not updated? But then the AWS error says ExportTableAccountStores and it still can't find it...
Any help? I tried to run npm cache verify but it did not work.