From ed958094f85b865d25563d8b3420d058baf99d11 Mon Sep 17 00:00:00 2001 From: Sebastian Schweizer Date: Fri, 28 Dec 2018 20:40:14 +0100 Subject: [PATCH] throw Error if detector is missing --- src/PluginState.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/PluginState.js b/src/PluginState.js index 69b0865..e0888ae 100644 --- a/src/PluginState.js +++ b/src/PluginState.js @@ -66,9 +66,12 @@ class PluginState { async getPolyfillDetector(polyfill) { const meta = await this._polyfillLibrary.describePolyfill(polyfill); if (meta) { - return meta.detectSource; + if (meta.detectSource) { + return meta.detectSource; + } + throw new Error(`[webpack-polyfill-injector] The polyfill ${polyfill} does not have a detector! Consider sending a PR with a suitable detect.js file to polyfill-library.`); } - throw new Error(`The polyfill ${polyfill} does not exist!`); + throw new Error(`[webpack-polyfill-injector] The polyfill ${polyfill} does not exist!`); } }