Skip to content

Commit d00e1a7

Browse files
committed
fix: fix no construct signatures error throw by typescript
1 parent ed58144 commit d00e1a7

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/index.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ import HtmlInlineScriptPlugin from './HtmlInlineScriptPlugin';
33

44
const isHtmlWebpackPluginV4 = 'getHooks' in htmlWebpackPlugin;
55

6-
module.exports = isHtmlWebpackPluginV4
7-
? HtmlInlineScriptPlugin
8-
: null;
6+
if (!isHtmlWebpackPluginV4) {
7+
// eslint-disable-next-line no-console
8+
console.error(
9+
'\x1b[35m%s \x1b[31m%s\x1b[0m',
10+
'[html-inline-script-webpack-plugin]',
11+
'Please upgrade your webpack to version 4 to use this plugin.'
12+
);
13+
14+
throw new Error('VERSION_INCOMPATIBLE');
15+
}
16+
17+
export = HtmlInlineScriptPlugin;

0 commit comments

Comments
 (0)