diff --git a/src/Bundle.js b/src/Bundle.js index 27f4a04..2f9189b 100644 --- a/src/Bundle.js +++ b/src/Bundle.js @@ -161,6 +161,7 @@ export default class Bundle { return Promise.resolve( this.resolveId( source, module.id ) ) .then( resolvedId => { if ( !resolvedId ) { + if ( source[0] === '.' ) throw new Error( `Could not resolve ${source} from ${module.id}` ); if ( !~this.external.indexOf( source ) ) this.onwarn( `Treating '${source}' as external dependency` ); module.resolvedIds[ source ] = source; diff --git a/test/function/no-relative-external/_config.js b/test/function/no-relative-external/_config.js new file mode 100644 index 0000000..37f86df --- /dev/null +++ b/test/function/no-relative-external/_config.js @@ -0,0 +1,8 @@ +var assert = require( 'assert' ); + +module.exports = { + description: 'missing relative imports are an error, not a warning', + error: function ( err ) { + assert.ok( /Could not resolve \.\/missing\.js from/.test( err.message ) ); + } +}; diff --git a/test/function/no-relative-external/main.js b/test/function/no-relative-external/main.js new file mode 100644 index 0000000..d0de2af --- /dev/null +++ b/test/function/no-relative-external/main.js @@ -0,0 +1 @@ +import missing from './missing.js';