Skip to content

Commit b9d7c14

Browse files
committed
Make it compatible with webpack 4
1 parent 4f2a149 commit b9d7c14

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ language: node_js
22
node_js:
33
- "4"
44
- "6"
5+
- "8"
56
script:
67
- npm test

index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ HtmlWebpackExcludeAssetsPlugin.prototype.apply = function (compiler) {
1414
var excludeAssets = htmlPluginData.plugin.options.excludeAssets;
1515
// Skip if the plugin configuration didn't set `excludeAssets`
1616
if (!excludeAssets) {
17-
return callback(null, htmlPluginData);
17+
if (callback) {
18+
return callback(null, htmlPluginData);
19+
} else {
20+
return Promise.resolve(htmlPluginData)
21+
}
1822
}
1923

2024
if (excludeAssets.constructor !== Array) {
@@ -27,7 +31,11 @@ HtmlWebpackExcludeAssetsPlugin.prototype.apply = function (compiler) {
2731
});
2832

2933
var result = self.processAssets(excludePatterns, htmlPluginData);
30-
callback(null, result);
34+
if (callback) {
35+
callback(null, result);
36+
} else {
37+
return Promise.resolve(result)
38+
}
3139
});
3240
});
3341
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "html-webpack-exclude-assets-plugin",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"description": "Add the ability to exclude assets based on RegExp patterns",
55
"main": "index.js",
66
"files": [

0 commit comments

Comments
 (0)