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:
I am not able to see the ponent.ts files in browser to debug. Is there any way to disable the bundling? angular-cli
version details:
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:
I am not able to see the ponent.ts files in browser to debug. Is there any way to disable the bundling? angular-cli
version details:
- You can see the .ts file in the browser. You need to find the line you want in the bundle(most likely main.js). If you add a debug point there, it will use the sourcemaps to place a debug pointer in your ponent.ts file. – peinearydevelopment Commented Jun 12, 2017 at 20:27
- Another way to acplish this in dev would be to put a debugger; statement in your ts file. – peinearydevelopment Commented Jun 12, 2017 at 20:27
3 Answers
Reset to default 10When 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://
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
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
Use following build mand to hide your source code under Sources Tab
ng build --no-sourcemap
( Development environment )
ng build --env=prod --no-sourcemap
(Production environment)