Skip to content

Commit 5162ecf

Browse files
macisiSimenB
authored andcommitted
fix: make webpack 4 compatible (#98)
1 parent 74d33fc commit 5162ecf

File tree

4 files changed

+437
-266
lines changed

4 files changed

+437
-266
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,19 @@
5555
"eslint": "^5.6.0",
5656
"eslint-config-simenb-base": "^15.0.0",
5757
"eslint_d": "^7.1.0",
58-
"html-webpack-plugin": "^2.10.0",
58+
"html-webpack-plugin": "^3.0.4",
5959
"husky": "^0.14.3",
6060
"in-publish": "^2.0.0",
6161
"jest": "^23.6.0",
6262
"jest-watch-typeahead": "^0.2.0",
6363
"licensor": "^4.0.0",
6464
"lint-staged": "^7.0.0",
6565
"prettier": "^1.8.2",
66-
"webpack": "^3.5.6"
66+
"webpack": "^4.0.0",
67+
"webpack-cli": "^3.1.0"
6768
},
6869
"peerDependencies": {
69-
"html-webpack-plugin": "^2.10.0 || ^3.0.4"
70+
"html-webpack-plugin": "^3.0.4"
7071
},
7172
"engines": {
7273
"node": ">=6"

src/addAllAssetsToCompilation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,6 @@ export default async function(assets, compilation, htmlPluginData, callback) {
112112
if (callback) {
113113
return callback(e, htmlPluginData);
114114
}
115-
throw e;
115+
throw new Error(e);
116116
}
117117
}

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ export default class AddAssetHtmlPlugin {
1010
compiler.plugin('compilation', compilation => {
1111
compilation.plugin(
1212
'html-webpack-plugin-before-html-generation',
13-
(htmlPluginData, callback) =>
14-
addAllAssetsToCompilation(
13+
async (htmlPluginData, callback) => {
14+
await addAllAssetsToCompilation(
1515
this.assets,
1616
compilation,
1717
htmlPluginData,
1818
callback,
19-
),
19+
);
20+
},
2021
);
2122
});
2223
}

0 commit comments

Comments
 (0)