@augurysys/ng-annotate-webpack-plugin

webpack plugin that runs ng-annotate on your bundles

Usage no npm install needed!

<script type="module">
  import augurysysNgAnnotateWebpackPlugin from 'https://cdn.skypack.dev/@augurysys/ng-annotate-webpack-plugin';
</script>

README

ng-annotate-webpack-plugin

A fork of https://github.com/jeffling/ng-annotate-webpack-plugin


WebPack plugin that runs ng-annotate on your bundles

Based on ngmin-webpack-plugin

Usage

In webpack.config.js:

var webpack = require('webpack');
var ngAnnotatePlugin = require('ng-annotate-webpack-plugin');

module.exports = {
    /// ... rest of config
    plugins: [
        new ngAnnotatePlugin()
    ]
}

To modify the default plugin options or to add options for ng-annotate:

var webpack = require('webpack');
var ngAnnotatePlugin = require('ng-annotate-webpack-plugin');

module.exports = {
    /// ... rest of config
    plugins: [
        new ngAnnotatePlugin({
            add: true,
            // other ng-annotate options here
        })
    ]
}

Since version 0.4.0: for performance reasons, chunks where the name starts with vendors~ are not annotated. To customize this behavior, set the option annotateChunk to a method that returns true if a chunk should be annotated:

var webpack = require('webpack');
var ngAnnotatePlugin = require('ng-annotate-webpack-plugin');

module.exports = {
    /// ... rest of config
    plugins: [
        new ngAnnotatePlugin({
            add: true,
            annotateChunk: (chunk) => !chunk.name || !chunk.name.startsWith("vendors~"),
            // other ng-annotate options here
        })
    ]
}