I have compiled my app via create react app: yarn build
//code is minified and obfuscated as expected
I have then deployed the app via both firebase serve
and firebase deploy
.
my firebase.json:
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "build",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
All is deployed "almost as expected", with 2 caveats:
The structure looks nothing like the build folder which contains the media... (necessary for fonts):
Am I setting something up incorrectly, deploying the wrong folder or possibly not ignoring something I should be? Exposing the entire js stack unminified and or without any obfuscation seems very "un-secure"...
Again, and as always any and all direction is greatly appreciated!
Strongly advise to refer to the create-react-app github discussion here about this matter but as a quick workaround you can add the following to your package.json scripts:
"scripts": {
...
"build": "npm run build-css && react-scripts build && yarn run delete-maps",
"delete-maps": "rm ./build/static/js/*.map && rm ./build/static/css/*.map",
...
}
This will however in the short run remove all of your source code from the Source tab in developer tools...
Prefixing GENERATE_SOURCEMAP=false
to your build target works too (which obviously doesn't generate sourcemap). In package.json
file.
GENERATE_SOURCEMAP=false react-scripts build
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With