I am using Google App Engine to host and serve my website, but I am encountering one issue when browsing on my website, I can retrieve all the source code I wrote in the dev tools:
Here are the two commands I am using when building and deploying :
"build:prod": "env-cmd -f .env.production react-scripts build",
"deploy:client-production": "copy app_to_add_in_build.yaml build/app_to_add_in_build.yaml && cd build/ && move app_to_add_in_build.yaml app.yaml && gcloud app deploy --project myProjectId",
I am copying & renaming my app.yaml
to the build folder then running the deploy from there.
Here is the content of my app.yaml
file:
runtime: nodejs12
handlers:
- url: '/service-worker.js'
secure: always
static_files: service-worker.js
upload: service-worker.js
mime_type: application/javascript
- url: /(precache-manifest.*)$
secure: always
mime_type: application/javascript
static_files: \1
upload: ./(precache-manifest.*)$
- url: /(.*\.js)$
secure: always
static_files: \1
upload: .*\.js$
mime_type: application/javascript
- url: /(.*\.(css|map|png|jpg|svg|ico|json|txt|woff))$
secure: always
static_files: \1
upload: .*\.(css|map|png|jpg|svg|ico|json|txt|woff)$
- url: '/(.*)'
secure: always
static_files: index.html
upload: index.html
Plus here is the content of the build folder
As we can see, there are no source files inside.
Once this is deployed, I browse the files in Google cloud debugger:
There are no source files inside.
I cleared my cache and cookies, reset my browser data, and tried with several browsers, I still have access to all Javascript/JSX sources. When serving the website, I see that it is using a React production build, but I am sure it's using the javascript files inside instead, as components are mounted twice (https://medium.com/@andreasheissenberger/react-components-render-twice-any-way-to-fix-this-91cf23961625).
I don't know where the issue comes from as nothing is cached anymore, neither on GCP, neither on my computer...
Do you have any clues if I did something wrong? Or any fixes?
Thank you in advance