Webber
Webber

Reputation: 194

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

Upvotes: 9

Views: 7924

Answers (3)

Bhanu Murthy
Bhanu Murthy

Reputation: 1

Use following build command to hide your source code under Sources Tab

ng build --no-sourcemap ( Development environment )

ng build --env=prod --no-sourcemap (Production environment)

Upvotes: -1

Kim Kern
Kim Kern

Reputation: 60557

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

Upvotes: 10

Webber
Webber

Reputation: 194

Yes also you can enable and disable this from the developer tool option Go to setting (press F12 then F1 ). Under the source you can enable and disable to source mapping. In deploy time you not going to put the map file so this will not get downloaded. Developer tool settings

Upvotes: 1

Related Questions