3
votes

I am working on POC where we have to package angular dist folder in spring mvc based web application(single war). This will be deployed in weblogic and tomcat. War file will serve the static content which is angular 2 app.

Now what i noticed is that when angular-cli builds the app, it is updating index.html with "script" tag to point to generated "js" files. I want to customize this script tag so that i can add "context" name in the url.

Is this something can be done? Or If I have to use webpack, does webpack support this customization?

here is example of script tag i would like to add during angular-cli build process

<script type="text/javascript" src="<CONTEXT-NAME>/inline.bundle.js"></script>
3
Have you found a solution? - Vnuuk

3 Answers

1
votes

@angular-builders/custom-webpack allows you to customize Angular build.
indexTransform option allows you to modify index.html (including script tags).

Disclaimer: I'm the owner of this project

0
votes

Have you tried this:

https://stackoverflow.com/a/40120805/2637605

For your specific techonolgy stack (Spring MVC with Angular) you might want to look into JHipster:

https://jhipster.github.io/

0
votes

In case someone comes upon this, you may set the script src prefix in the .angular-cli.json file

  "apps": [
    {
      "deployUrl": "<CONTEXT-NAME>/"
    }]