Q:

Error: In this configuration Angular requires Zone.js

I'm trying to run a Grails 2.3.9 application that use inside Angular 5. For this i create a new Grails project and a new angular project with angular-cli (ng new app). After this i made these steps.

Build the angular project to get the resources bundles: ng build --prod
Copy the already created dist folder's files and paste it in the Grails project in web-app/js/lib
In grails create a new Controller and view to serve the index for angular
In the index.gsp i put the content of the index.html that was created in angular build and replace the src of the scripts with Grails create link statements pointing to js/lib/... to be able for Grails to serve correctly those files

When I run my Grails app and go to the specified address for angular to run I get a blank page and in the console this error:
Error: In this configuration Angular requires Zone.js

I try to copy the dist folder in an Apache server and everything works fine, so, i don't think that the problem is related to the generated files after ng build --prod.

A:

Ok, i figure it out, the problem was the way that i was referencing the angular js resources in the index.gsp:
Wrong way
index.gsp
<html>
   <head></head>
   <body>
     <app-root></app-root>
     <script src="${createLink(uri:'js/lib/inline.bundle.js')}"</script>
     <script src="${createLink(uri:'js/lib/polyfills.bundle.js')}"</script>
     <script src="${createLink(uri:'js/lib/main.bundle.js')}"</script>
   </body>
</html>

Correct way
ApplicationResources.groovy
modules = {
  ...
  angular{
    resource url:"js/lib/styles.bundle.css", nominify:true, disposition: 'head'
    resource url:"js/lib/inline.bundle.js", nominify:true
    resource url:"js/lib/polyfills.bundle.js", nominify:true
    resource url:"js/lib/main.bundle.js", nominify:true
  }
}

index.gsp
<html>
   <head>
     ...
     <r:require modules="angular"/>
     <r:layoutResources/>   
   </head>
   <body>
     <app-root></app-root>
     <r:layoutResources/>
   </body>
</html>

The correct way to add resources in grails 2 was found here

