Angular is using Webpack under the hood.
The instruction below will guide you through setting up the custom builders from the @angular-builders/custom-webpack
package, which will allow you to add the Webpack plugin to your development build configuration (i.e. it will be active only when using the ng serve
).
Note: Enabling instrumentation has a considerable performance and memory footprint. Make sure not to enable it in production mode.
npm install --save-dev @rxjs-insights/rxjs7
Note: The version of the
@rxjs-insights/rxjs<version>
package needs to match the version of RxJS. For example, if you are using RxJS 6, you need to runnpm install --save-dev @rxjs-insights/rxjs6
.
npm install --save-dev @rxjs-insights/plugin-webpack5
Note: The version of the
@rxjs-insights/plugin-webpack<version>
package needs to match the version of Webpack. For example, if you are using Angular 11 (which by default uses Webpack 4), you need to runnpm install --save-dev @rxjs-insights/plugin-webpack4
.
npm install --save-dev @angular-builders/custom-webpack
Note: The version of the
@angular-builders/custom-webpack
package needs to match the version of Angular. For example, if you are using Angular 12, you need to runnpm install --save-dev @angular-builders/custom-webpack@^12
.
- Place it next to the
angular.json
file. - Set its content to:
const { RxjsInsightsPlugin } = require('@rxjs-insights/plugin-webpack5');
module.exports = {
plugins: [
new RxjsInsightsPlugin()
]
}
Note: If you installed e.g.
@rxjs-insights/plugin-webpack4
package, you'll need to adjust therequire
path accordingly.
- Set the
projects.<project>.architect.serve.builder
property value to@angular-builders/custom-webpack:dev-server
. - Set the
projects.<project>.architect.build.builder
property value to@angular-builders/custom-webpack:browser
. - Set the
projects.<project>.architect.build.configurations.development.customWebpackConfig
property value to{ "path": "development.config.js" }
.