angular - Loading scripts from index.html Vs Node Package install -
i newbie angular2, far know 2 ways of adding external css/js app.
directly in
index.html
- could cdn or local file.
installing external npm package using
npm install <package-name>
- note: works if package available in npm
i trying use external js not available in npm of now. so, adding in index.html
now, 2 part question.
- does adding external links in
index.html
reduces build time(anyway it's super fast) inangular build --prod --aot
? - by using of 2 ways of adding external js/css files, there performance impact in browser while using app or has no impact on performance?
just recap said in comments.
adding js file index.html
may reduce build time, exclude being watch webpack. webpack bundling files , removed dead code or sorts out duplicated dependencies. there definite advantage of importing node package using npm install
but not possible. need add index.html, won't have advantage out of this.
if package not on npm on github can install github. here small example using jquery repo:
npm install https://github.com/jquery/jquery/tarball/master --save
important use tarball instead of tree. install jquery in application.
Comments
Post a Comment