diff options
Diffstat (limited to 'src/utils/patchWebpack.ts')
-rw-r--r-- | src/utils/patchWebpack.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/utils/patchWebpack.ts b/src/utils/patchWebpack.ts index 0e94694..9f4b435 100644 --- a/src/utils/patchWebpack.ts +++ b/src/utils/patchWebpack.ts @@ -1,6 +1,6 @@ import { WEBPACK_CHUNK } from './constants'; import Logger from "./logger"; -import { _initWebpack } from "./webpack"; +import { _initWebpack } from "../webpack"; let webpackChunk: any[]; @@ -83,9 +83,13 @@ function patchPush() { const lastCode = code; try { const newCode = code.replace(replacement.match, replacement.replace); - const newMod = (0, eval)(`// Webpack Module ${id} - Patched by ${[...patchedBy].join(", ")}\n${newCode}\n//# sourceURL=WebpackModule${id}`); - code = newCode; - mod = newMod; + if (newCode === code) { + logger.warn(`Patch by ${patch.plugin} had no effect: ${replacement.match}`); + } else { + const newMod = (0, eval)(`// Webpack Module ${id} - Patched by ${[...patchedBy].join(", ")}\n${newCode}\n//# sourceURL=WebpackModule${id}`); + code = newCode; + mod = newMod; + } } catch (err) { logger.error("Failed to apply patch of", patch.plugin, err); code = lastCode; |