Too many files with ng build --prof

165 views
Skip to first unread message

Francesco Favero

unread,
Sep 22, 2019, 2:11:13 PM9/22/19
to Angular and AngularJS discussion
Hello everyone.
I recently upgraded to angular8 a toy project I was working on.
Surprisingly, niw when I build the project with ng build --prod, it creates various strange files (named eg 1.js 3.js...), in addition to the expected assets, polyfill.js, runtme.js ... and so on.
I couldn't find any explanation on the docs or in google for this, so I decided to stop by here.

The problem is that serving the app within a Django backend the js code is looking for deps dencies in the '/' path when all the static files are in '/static'.
The ugly fox for now it's to set the base url in the index.html template to '/static', but I'd like to avoid it.

Does anyone know if this is normal?

Best

Francesco

Francesco Favero

unread,
Sep 22, 2019, 2:11:13 PM9/22/19
to Angular and AngularJS discussion
Hello everyone.
I recently upgraded to angular8 a toy project I was working on.
Surprisingly, niw when I build the project with ng build --prod, it creates various strange files (named eg 1.js 3.js...), in addition to the expected assets, polyfill.js, runtme.js ... and so on.
I couldn't find any explanation on the docs or in google for this, so I decided to stop by here.

The problem is that serving the app within a Django backend the js code is looking for depe dencies in the '/' path when all the static files are in '/static'.

Sander Elias

unread,
Sep 23, 2019, 7:29:47 AM9/23/19
to Angular and AngularJS discussion
Hi Francesco,

You can build with the correct baseUrl by using it like:

ng build --baseHref="/static/"

The numbered files are your module. Also, you get 2 versions of each one, an es2015, and an es5 version. In modern browsers, there is less need for polyfills and compiling to an old JS version.

Regards
Sander

Francesco Favero

unread,
Sep 24, 2019, 2:40:51 PM9/24/19
to ang...@googlegroups.com
Hi Sander,

I've managed to get it working by configuring differently my Django application (use whitenoise to serve static files).

I'll give it a go with the baseHref option to se the behavior :-).

Thanks a lot :-).

Best
Francesco



--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/ac8841a9-f3bc-4e91-badf-8e7f6721daeb%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages