Skip to content Skip to sidebar Skip to footer

How To Start Angular2 Project With Minimum Of Required Files Using Npm?

I was following Angular2 quickstart and installed required libraries using Node package manager: https://angular.io/guide/quickstart created a package.json: { 'name': 'angular2-q

Solution 1:

You can use the cdn versions of those files and use node_modules in development and don't include them in production at all:

<scriptsrc="https://rawgithub.com/systemjs/systemjs/0.19.6/dist/system.js"></script><scriptsrc="https://code.angularjs.org/2.0.0-beta.0/angular2-polyfills.js"></script><scriptsrc="https://code.angularjs.org/2.0.0-beta.0/Rx.js"></script><scriptsrc="https://code.angularjs.org/2.0.0-beta.0/angular2.dev.js"></script>

Take a look at this question and the comments in the answers: Angular 2 required libraries

Also this is the smallest package.json you can get away with (depending in your setup):

{ "dependencies": { "angular2": "2.0.0-beta.0", "systemjs": "0.19.6" } }

I'm using Webstorm which starts its own server and compiles typescript on its own when it detects the tsconfig.json file.

So if you don't have your own server you'll need to add the lite-server dependency, config and scripts, and if you don't have a ts compiler you'll have to add the typescript dependency and scripts as well:

"devDependencies": { "typescript": "^1.7.3" },

Solution 2:

You could use ng new barebones-app --minimal

Solution 3:

You can remove unnecessary dependencies from package.json. Also, dependencies declared in devDependencies section is not bundled when packaging for production.

Post a Comment for "How To Start Angular2 Project With Minimum Of Required Files Using Npm?"