Closed rolivencia closed 2 years ago
Howdy, Please provide some logs from the console with OneSignal logging turned on.
Also, did you see the troubleshooting note regarding service workers in the README instructions?
Try visiting the file in the browser and make sure it is loading.
Yes, I considered what's detailed in the troubleshoot section, but the problem only happens depending on the build profile that is selected when building. The file is loaded correctly, but not working as expected when the "serviceWorker"
flag is set to true.
These settings work on the angular.json build configuration. They're the "default" for local serve or non-production builds
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
These settings are causing the OneSignal provider not to work correctly, which are the ones for --configuration production
build:
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"serviceWorker": true,
After testing and debugging, I found out that the flag that was causing the problem was "serviceWorker": true
. Removing it solved the problem, and the OneSignal provider started to work as expected.
I'll attach the log you've asked for as soon as possible.
Closing due to inactivity
After some tests with different compile settings (local, staging, production) in an Angular app I deployed, I found out that if the flag
"serviceWorker"
is set to true inangular.json
, then the application is not able to receive notifications nor correctly instantiates or handles the OneSignal provider.The place where this setting must be removed or set to false, is specifically in the
projects -> app -> architect -> build -> configurations -> production
setting,Environment you discovered this bug in (run ng version)