0

I am new to Angular 2. I have developed one small application. In my application there is a Login and Register page.

After all done I have build my app using

ng build --prod --aot

All the js is minified and It all work fine.

My question is now I have to do a little change

like change label text 'Username' to 'Email'

Is I need to do change and rebuild full solution every time for this type of small changes?

Jigarb1992
  • 828
  • 2
  • 18
  • 41
  • 1
    short answer: yes. – n00dl3 Apr 20 '17 at 14:42
  • If you can locate the string in the build output, you can change it manually, but that seems way more cumbersome than changing it in the source and rebuilding. – Günter Zöchbauer Apr 20 '17 at 14:43
  • If it was compiled C++, would you edit the executable by hand with an hexadecimal editor for such a thing ? – n00dl3 Apr 20 '17 at 14:46
  • @n00dl3 it is correct about C++, But I compare it with other web technologies like php, asp.net, mvc, jsp, python, etc. I all other to change a little text in html is not needed to rebuild the full solution. – Jigarb1992 Apr 20 '17 at 14:56
  • That does not make sense to compare to language where you don't need to compile or minify (why would someone minify python code ?). What is the point in looking for a string on a single 999999999999999 characters line that will not get added to the source code, or version control to gain 2 minutes ? What I mean is you can do it, but that does not mean it's a great idea. – n00dl3 Apr 20 '17 at 15:17
  • @n00dl3 you are correct at your point. And I am not talking about any great idea!!, My question is just to change a text in HTML we need to rebuild full solution? a single `Hello World` app need 8-9 sec. for build, Think of the application that have 20-30 modules may it take a 2-3 min for build, and then just to change a text we rebuild every time!!!!!! – Jigarb1992 Apr 20 '17 at 15:26

2 Answers2

0

How can I do it without rebuilding the application?

Change the env-specific.json file at deployment time with the proper file This is the type of issue that is important to know when coding an enterprise Angular 2 or Angular 4 application.

Check out this link click here

Mahendra Waykos
  • 666
  • 2
  • 7
  • 18
-1

With ng build --prod, you are building the application in production mode.

Until you have some development you should first build/serve the application in development mode. Angular-cli will watch source files for changes. So use the following command instead:

ng serve

Once you're done with changes, then you build in production mode like you did. If you have some modification to do afterwards, you always edit the source files, which assumes you have to rebuild the project.

Michel
  • 26,600
  • 6
  • 64
  • 69
  • Thank you, But a single application created using `ng new` its size is approx 130 MB. I must have to minify and build in production mode to decrease the size and also to speedup my application. – Jigarb1992 Apr 20 '17 at 14:52
  • I thought you were looking for a command which will build and watch your source files. Naturally, for production you will build your application in production mode. And if you need to change something after this, there is no magic, you have to rebuild your project. – Michel Apr 20 '17 at 15:07