angular - Loading scripts from index.html Vs Node Package install -


i newbie angular2, far know 2 ways of adding external css/js app.

  1. directly in index.html

    • could cdn or local file.
  2. 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.

  1. does adding external links in index.html reduces build time(anyway it's super fast) in angular build --prod --aot?
  2. 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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -