Note: for support questions, please use one of these channels:
https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/
Issuing ionic build android --release --prod creates production apk which still includes source maps. Those must be disabled in the production build
Source maps disabled in production build.
Steps to reproduce:
insert any relevant code between the above and below backticks
Which @ionic/app-scripts version are you using?
1.3.7
Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
Hi @ryaa,
Since you have the ionic_generate_source_map flag set to true, it makes sense that the source map is preserved. This is by design.
Thanks,
Dan
Setting this to false gives an error. The same as here https://github.com/driftyco/ionic-app-scripts/issues/934
So I don't see any way to disable source maps for the PROD build. That's the problem
Dan, here you state that source maps are disabled for prod build by default - see comment made on Jan 11 https://github.com/driftyco/ionic-app-scripts/issues/289#issuecomment-271899536
Not using eval source maps will fix it. eval source maps for prod would be very bad.
Thanks,
Dan
Dan, are you saying that if i use anything besides eval (for example "ionic_source_map_type": "#inline-source-map" or "source-map") and "ionic_generate_source_map": is true the ionic-app-scripts will disable the source maps by default in PROD build?
The problem is that it is not possible to create PROD build without source maps. The "ionic_generate_source_map": false configuration does not work (gives an error) and if it is true it includes source maps into the production build.
@ryaa,
Remove ionic_generate_source_map from package.json unless you want a source map.
Remove ionic_source_map_type as well.
You should be good to go.
Thanks,
Dan
using this will fix it
ionic-app-scripts build --prod --generateSourceMap false
Thank you very much @aelsharif
This did the trick!
Note that "ionic_source_map_type" must be "source-map"
If this is "ionic_source_map_type": "#inline-source-map" it still triggers the error even with --generateSourceMap false
@ryaa if ionic_source_map_type is source-map, then I don't get any source maps when building debug builds!
@cocowalla what is the ionic-app-scripts version? and what is the value for "ionic_generate_source_map"? if it is false and you use the latest ionic-app-scripts version that this is expected behaviour, I think
@ryaa app-scripts are at 2.1.4, but this problem has persisted for many previous versions.
ionic_generate_source_map is not set in package.json. if I set it to true and ionic_source_map_type is source-map, I still don't get any source maps - I only get them using #inline-source-map - but then of course I can't built with --prod --release!
@cocowalla strange. I use 2.1.3 and can generate source maps with ionic_generate_source_map true and ionic_source_map_type source-map settings...
@ryaa it doesn't work for me, or anyone else on my team. In on Windows, if it makes any difference:
cli packages: (C:\MyProj\node_modules)
@ionic/cli-plugin-proxy : 1.4.6
@ionic/cli-utils : 1.9.2
ionic (Ionic CLI) : 3.9.2
global packages:
Cordova CLI : not installed
local packages:
@ionic/app-scripts : 2.1.4
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.6.0
System:
Android SDK Tools : 26.0.2
Node : v6.11.0
npm : 3.10.10
OS : Windows 7
I have the same problem
ionic cordova build browser --prod --release --generateSourceMap false
Appears to do nothing -- how does one disable sourcemaps completely in production?
Source map error: request failed with status 404 Resource URL: https://domain.com/build/main.js Source Map URL: /path/to/local/dev/filesystem/www/build/main.js.map
Even if the sourcemap 404s I'd really prefer not advertising my local filesystem to the world.
I disabled source map completely from the prod release by doing the below:
1) set the below in package.json
"config": {
"ionic_bundler": "webpack",
"ionic_generate_source_map": false,
"ionic_source_map_type": "source-map"
}
2) issue
ionic cordova build android --release --prod
This works with ionic cli 3.19.1
Most helpful comment
using this will fix it
ionic-app-scripts build --prod --generateSourceMap false