Skip to content

Webpack5 #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ module.exports = {
}
```

Since version 0.4.1: switched to maintained fork of `ng-annotate`: [ng-annotate-patched](https://github.com/bluetech/ng-annotate-patched) to benefit from its improvements.

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:
Expand Down
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

var ngAnnotate = require('ng-annotate'),
SourceMapSource = require('webpack-core/lib/SourceMapSource');
var ngAnnotate = require('ng-annotate-patched'),
SourceMapSource = require('webpack-core/lib/SourceMapSource'),
OriginalSource = require('webpack-core/lib/OriginalSource');

function ngAnnotatePlugin(options) {
this.options = options || { add: true, sourceMap: false };
Expand Down Expand Up @@ -47,9 +48,12 @@ ngAnnotatePlugin.prototype.apply = function apply(compiler) {
if (options.sourceMap && asset.sourceAndMap) {
compilation.assets[file] = new SourceMapSource(value.src, file, JSON.parse(value.map), input, map);
}
else {
else if (map) {
compilation.assets[file] = new SourceMapSource(value.src, file, map);
}
else {
compilation.assets[file] = new OriginalSource(value.src, file);
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ng-annotate-webpack-plugin",
"version": "0.4.0",
"description": "webpack plugin that runs ng-annotate on your bundles",
"version": "0.5.0",
"description": "webpack plugin that runs ng-annotate-patched on your bundles",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand All @@ -22,7 +22,7 @@
},
"homepage": "https://github.com/cliechty/ng-annotate-webpack-plugin",
"dependencies": {
"ng-annotate": "^1.2.1",
"webpack-core": "^0.6.5"
"ng-annotate-patched": "^1.13.0",
"webpack-core": "^0.6.9"
}
}