I’m working on an old Grails code base. One of the pages (well, at least one) uses Angular 1.7.8. A few months ago, I made some client-side changes to the Angular page, which all work fine.
However, the other day another dev pointed out that the asset pipeline build was reporting failures for one of the JavaScript files involved, specifically about ?? in a couple of expressions. The Closure Compiler in the system, it turns out, is from 2016, so it doesn’t know what that means.
Even with that build failure, the application launches and the page works fine, as it did when I was first working on it. (I didn’t notice the errors; the build output is filled with noise so for me at least it’s easy to make that mistake.)
Specifically, the code in the containing GSP page looks like:
<div ng-app="mycompany.app.addressLocker">
<address-locker-list>
</address-locker-list>
</div>
Fixing that issue with the build was trivial of course; I just switched to ||. But I wondered why things worked with the errors. So from the page in the app running, I checked the HTTP requests for the JavaScript, and it was asking for
address-locker-list.component.js?compile=false
(That’s the file where the build error was.) However, with or without the build error, I still got the plain text of that source file, and of course the browser doesn’t mind the ??. So I checked the .war file, and in the assets tree there are four files:
target/assets/addresslocker/angular/address-locker-list/address-locker-list-b081ab79e0cd94698fbf64390b1079f3.html
target/assets/addresslocker/angular/address-locker-list/address-locker-list.component.unminified.js
target/assets/addresslocker/angular/address-locker-list/address-locker-list.component.js.map
target/assets/addresslocker/angular/address-locker-list/address-locker-list.component-9661c3fd0fbc0fb060bdd9e80f67fe1b.js
With the build error, the file with the checksum or hash or whatever is empty. With the fix, it’s got the minified code. However, note that in either case there is no file with the plain path address-locker-list.component.js. When I fetch that path as used by the client-side code from a separate browser tab, it works fine.
So my question is, what the heck is going on? Something, somewhere, as far as I can tell inside Grails code somewhere, something is deciding whether to use the minified or unminified version of the file, and (for more reasons I don’t know) always choosing the unminified version.
I am in no sense a Grails expert, nor am I an Angular expert, but as I’ve said everything in actual practice works just fine. But I would be grateful for any information on what sort of config stuff inside Grails needs to be modified to tell it it’s OK to use the minified code, or alternatively how to stop wasting all that time minifying a big pile of source code when the minified stuff is always ignored anyway.
Of course if it’d help to see the Angular code I’m happy to add it; I have not found anything in the JavaScript or HTML files (it’s a small cluster of code) that jumps out at me as having any bearing on my confusion.