Skip to content

Commit 1d5959d

Browse files
authored
fix: webpack deprecation warning (closes #8) (#9)
fix: webpack deprecation warning (closes #8)
2 parents c784f8d + 96cee99 commit 1d5959d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"printWidth": 80,
3+
"semi": true,
4+
"trailingComma": "es5",
5+
"singleQuote": true,
6+
"jsxBracketSameLine": true,
7+
"proseWrap": true
8+
}

index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class NetlifyServerPushPlugin {
1919
}
2020

2121
apply(compiler) {
22-
compiler.plugin('emit', (compilation, callback) => {
22+
const handler = (compilation, callback) => {
2323
const routes = [];
2424
// Set default value as comment incase if this file is not present
2525
let mainJs = '# no js files';
@@ -76,7 +76,14 @@ class NetlifyServerPushPlugin {
7676
};
7777

7878
callback();
79-
});
79+
return compilation;
80+
};
81+
82+
if (compiler.hooks) {
83+
compiler.hooks.emit.tapAsync('NetlifyServerPushPlugin', handler);
84+
} else {
85+
compiler.plugin('emit', handler);
86+
}
8087
}
8188
}
8289

0 commit comments

Comments
 (0)