Skip to content Skip to sidebar Skip to footer

How To Load Minified File In Angular 2 Using Gulp Uglify ? (which Minifies Typescript Bundled File)

I have a angular 2 application in which typescript compiler options is defined to generate a single outFile which is Scripts1.js and Scripts1.js.map Now in my index.html

Solution 1:

Better use Angular 2 CLI for developing apps. It provides all baseline works like build, run, unit testing, transpiling of TS files, with NG commands you can create pages, routes with pre-defined code.

Uglify can also be done by changing Angular 2 CLI environment to PROD

Solution 2:

If you create bundle from all of your files it would be better to use Webpack and not system.JS (System JS load every module file at runtime while Webpack make a bundle from all your file)

There is a great explanation on how to create a webpack file in the original angular documentation. https://angular.io/docs/ts/latest/guide/webpack.html

Solution 3:

Try gulp uglify with mangle option set as false. i.e .pipe(uglify(), {mangle : false})

Post a Comment for "How To Load Minified File In Angular 2 Using Gulp Uglify ? (which Minifies Typescript Bundled File)"