From 3673001a24cb24c57454f9bc7619de49d2c3a044 Mon Sep 17 00:00:00 2001 From: Mohammed Sahl <32067562+mohammedsahl@users.noreply.github.com> Date: Tue, 23 Jun 2020 12:33:22 -0400 Subject: [PATCH] fix: Add error handling for missing dependencies (fixes #1210) (#1232) * Add error handling for missing dependencies * Informative error message * Add error handling for missing dependencies * Informative error message * Add dependecy import location, error message changes --- build/build.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/build/build.js b/build/build.js index 7dfa6b536..563861373 100644 --- a/build/build.js +++ b/build/build.js @@ -29,7 +29,17 @@ async function build(opts) { __VERSION__: version, 'process.env.SSR': false }) - ]) + ]), + onwarn: function (message) { + if (message.code === 'UNRESOLVED_IMPORT') { + throw new Error( + `Could not resolve module ` + + message.source + + `. Try running 'npm install' or using rollup's 'external' option if this is an external dependency. ` + + `Module ${message.source} is imported in ${message.importer}` + ) + } + } }) .then(function (bundle) { var dest = 'lib/' + (opts.output || opts.input)