Skip to content

Commit

Permalink
Merge pull request #40 from bluetech/allow-to-use-fork
Browse files Browse the repository at this point in the history
Add an option to use a fork of ng-annotate
  • Loading branch information
Andrey authored Apr 28, 2017
2 parents 85f020e + d247d3e commit c17489f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ module: {
}
```

#### Using a fork of ng-annotate:

```js
{
test: /src.*\.js$/,
use: [
{
loader: 'ng-annotate-loader',
options: {
ngAnnotate: 'my-ng-annotate-fork'
}
}
]
}
```

#### Works great with js compilers, `babel` for example:

```js
Expand Down
2 changes: 1 addition & 1 deletion loader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var ngAnnotate = require('ng-annotate');
var utils = require('loader-utils');
var SourceMapConsumer = require('source-map').SourceMapConsumer;
var SourceMapGenerator = require('source-map').SourceMapGenerator;
Expand Down Expand Up @@ -73,6 +72,7 @@ module.exports = function(source, inputSourceMap) {
var filename = normalizePath(this.resourcePath);
this.cacheable && this.cacheable();

var ngAnnotate = require((utils.getOptions(this) || {}).ngAnnotate || 'ng-annotate');
var annotateResult = ngAnnotate(source, getOptions.call(this, sourceMapEnabled, filename));

if (annotateResult.errors) {
Expand Down

0 comments on commit c17489f

Please sign in to comment.