Skip to content

Commit

Permalink
less cryptic error if entry module is external (#1264)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Jul 9, 2017
1 parent dcda451 commit b26ac1d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Bundle.js
Expand Up @@ -122,6 +122,13 @@ export default class Bundle {
// of the entry module's dependencies
return this.resolveId( this.entry, undefined )
.then( id => {
if ( id === false ) {
error({
code: 'UNRESOLVED_ENTRY',
message: `Entry module cannot be external`
});
}

if ( id == null ) {
error({
code: 'UNRESOLVED_ENTRY',
Expand Down
10 changes: 10 additions & 0 deletions test/function/external-function-always-true/_config.js
@@ -0,0 +1,10 @@
module.exports = {
description: 'prints useful error if external returns true for entry (#1264)',
options: {
external: id => true
},
error: {
code: 'UNRESOLVED_ENTRY',
message: 'Entry module cannot be external'
}
};
2 changes: 2 additions & 0 deletions test/function/external-function-always-true/main.js
@@ -0,0 +1,2 @@
import ext from 'external';
assert.equal( ext, 42 );

0 comments on commit b26ac1d

Please sign in to comment.