Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the default bundling in angular CLI with Angular 4

I am new to webpack and angular-cli. My problem is that when I create an Angular 4 project using angular-cli, everything works fine with ng-serve but everything get bundled by default. Web pack bundling info:

Web pack bundling info

I am not able to see the component.ts files in browser to debug. Is there any way to disable the bundling? angular-cli version details:

Angular CLI version Details

like image 729
Webber Avatar asked Jun 12 '17 20:06

Webber


People also ask

Is it possible to disable differential loading in Angular?

How To Disable Differential Loading in Angular Applications. Adjust browserslist to only consider the web browsers that we actually want to support. Ensure that we have specified "target": "es2015" as the target in tsconfig. json .

What is main bundle JS in Angular?

bundle. js which includes all the scripts to fill the gap between the version of Javascript that Angular needs and the version of Javascript supported by most browsers. polyfills.bundle.js. Here we can see👇 another bundle which is a main. bundle.

What is Sourcemap in Angular json?

Sentry supports demangling of transpiled, minified, and bundled JavaScript using source maps, which are JSON files that contain information about how to map your deployed code back to its original source(s).

What is environment TS file in Angular?

A project's src/environments/ folder contains the base configuration file, environment. ts , which provides a default environment. You can add override defaults for additional environments, such as production and staging, in target-specific configuration files. For example: myProject/src/environments.


1 Answers

When you do ng serve with the CLI, it will create sourcemap files by default. That means, that although the source files are bundled together, you can view the original source files in the debugger and step through them. You find them in the DevTools under the tab Sources, the folder webpack://

Sourcemaps in DevTools

If you want to view your prod build like this, you can add the flag -sm for sourcemaps. In the prod build, there won't be sourcemaps by default.

ng serve --prod -sm
like image 107
Kim Kern Avatar answered Oct 02 '22 07:10

Kim Kern