Steps to replicate the issue (include links if applicable):
- Add the attached JavaScript file to the scripts array of ResourceModules in extension.json
- Look at the minified JavaScript served by ResourceLoader.
- When using URLs with &debug=true added, all works as expected (as no minification takes place)
What happens?:
This is the original function:
function get_austria_feature() { let austria_wkt = "POLYGON ((9.599 47.269, 9.767 47.523, 9.986 47.442, 10.192 47.234, 10.366 47.287, 10.488 47.497, 10.814 47.477, 11.052 47.349, 11.732 47.539, 12.211 47.578, 12.269 47.656, 12.474 47.593, 12.676 47.622, 12.839 47.471, 13.039 47.436, 13.120 47.661, 12.989 47.754, 13.019 47.900, 12.864 48.130, 13.419 48.328, 13.516 48.523, 13.769 48.509, 13.867 48.699, 14.173 48.535, 14.726 48.561, 14.851 48.728, 14.983 48.751, 15.036 48.954, 15.803 48.820, 16.041 48.711, 16.374 48.694, 16.496 48.754, 16.831 48.668, 16.800 48.376, 17.050 48.001, 16.985 47.742, 16.583 47.795, 16.363 47.696, 16.605 47.538, 16.379 47.412, 16.402 47.043, 15.994 46.879, 15.914 46.732, 14.874 46.649, 14.538 46.455, 12.501 46.715, 12.213 46.957, 12.267 47.065, 12.181 47.126, 11.762 47.031, 11.220 47.018, 10.925 46.815, 10.520 46.900, 10.359 47.029, 10.134 46.899, 9.674 47.095, 9.599 47.269))"; let format = new OlFormatWkt(); let feature = format.readFeature(austria_wkt, { dataProjection: EPSG4326, featureProjection: EPSG3857 }); return feature; }
This is the served function after un-minifying it by the Firefox debugger:
function get_austria_feature() { let austria_wkt = 'POLYGON ((9.599 47.269, 9.767 47.523, 9.986 47.442, 10.192 47.234, 10.366 47.287, 10.488 47.497, 10.814 47.477, 11.052 47.349, 11.732 47.539, 12.211 47.578, 12.269 47.656, 12.474 47.593, 12.676 47.622, 12.839 47.471, 13.039 47.436, 13.120 47.661, 12.989 47.754, 13.019 47.900, 12.864 48.130, 13.419 48.328, 13.516 48.523, 13.769 48.509, 13.867 48.699, 14.173 48.535, 14.726 48.561, 14.851 48.728, 14.983 48.751, 15.036 48.954, 15.803 48.820, 16.041 48.711, 16.374 48.694, 16.496 48.754, 16.831 48.668, 16.800 48.376, 17.050 48.001, 16.985 47.742, 16.583 47.795, 16.363 47.696, 16.605 47.538, 16.379 47.412, 16.402 47.043, 15.994 46.879, 15.914 46.732, 14.874 46.649, 14.538 46.455, 12.501 46.715, 12.213 46.957, 12.267 47.065, 12.181 47.126, 11.762 47.031, 11.220 47.018, 10.925 46.815, 10.520 46.900, 10.359 47.029, 10.134 46.899, 9.674 47.095, 9.599 47.269))'; let format = new OlFormatWkt(); let feature = format.readFeature(austria_wkt, { dataProjection: EPSG4326, featureProjection: EPSG3857 }); return feature; }
This causes the function to return undefined and therefore the script causing a runtime error when using the returned value.
What should have happened instead?:
There should be no line break in return feature.
Software version (skip for WMF-hosted wikis like Wikipedia):
- MediaWiki 1.39.5
- It ships with minify 2.3.0
Other information (browser name/version, screenshots, etc.):
See attachments of original and minified version.