Skip to content

Commit 3673001

Browse files
authored
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
1 parent 4b02177 commit 3673001

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Diff for: build/build.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,17 @@ async function build(opts) {
2929
__VERSION__: version,
3030
'process.env.SSR': false
3131
})
32-
])
32+
]),
33+
onwarn: function (message) {
34+
if (message.code === 'UNRESOLVED_IMPORT') {
35+
throw new Error(
36+
`Could not resolve module ` +
37+
message.source +
38+
`. Try running 'npm install' or using rollup's 'external' option if this is an external dependency. ` +
39+
`Module ${message.source} is imported in ${message.importer}`
40+
)
41+
}
42+
}
3343
})
3444
.then(function (bundle) {
3545
var dest = 'lib/' + (opts.output || opts.input)

0 commit comments

Comments
 (0)