Skip to content

Commit 70f212a

Browse files
committed
prevent running via webpack-dev-server
1 parent 189c26e commit 70f212a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,15 @@ class WebpackObfuscator {
2121
}
2222

2323
public apply(compiler: Compiler): void {
24-
const pluginName = this.constructor.name;
24+
const isDevServer = process.argv.find(v => v.includes('webpack-dev-server'));
25+
if (isDevServer) {
26+
console.info(
27+
'JavascriptObfuscator is disabled on webpack-dev-server as the reloading scripts ',
28+
'and the obfuscator can interfere with each other and break the build');
29+
return;
30+
}
2531

32+
const pluginName = this.constructor.name;
2633
compiler.hooks.emit.tap(pluginName, (compilation: compilation.Compilation) => {
2734
for (const fileName in compilation.assets) {
2835
if (fileName.toLowerCase().endsWith('.js') || this.shouldExclude(fileName)) {

0 commit comments

Comments
 (0)