Skip to content

Commit

Permalink
throw Error if detector is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianS90 committed Dec 28, 2018
1 parent 13ffc63 commit ed95809
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/PluginState.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!`);
}
}

Expand Down

0 comments on commit ed95809

Please sign in to comment.