From 59899ecd74d068de13ed7a289af7072dbdf370d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmie=20P=C3=A4iv=C3=A4rinta?= Date: Thu, 31 May 2018 13:55:37 +0200 Subject: [PATCH] Ensure imports outside jail are marked as external Fixes an issue where imports outside the jail directory where not marked as external, causing Rollup to display a warning about the dependency not being resolved since the resolution was deferred. --- src/index.js | 2 +- test/test.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 825930a..e007a10 100644 --- a/src/index.js +++ b/src/index.js @@ -184,7 +184,7 @@ export default function nodeResolve ( options = {} ) { } fulfil( null ); } else if ( jail && resolved.indexOf( normalize( jail.trim( sep ) ) ) !== 0 ) { - fulfil( null ); + fulfil( false ); } } diff --git a/test/test.js b/test/test.js index 47d44b8..96fa306 100644 --- a/test/test.js +++ b/test/test.js @@ -557,7 +557,10 @@ describe( 'rollup-plugin-node-resolve', function () { input: 'samples/jail/main.js', plugins: [ nodeResolve({ jail: `${__dirname}/samples/` - }) ] + }) ], + onwarn: (err) => { + if ( err.code && err.code === 'UNRESOLVED_IMPORT' ) throw err; + } }).then( (bundle) => { assert.deepEqual(bundle.imports, [ 'string/uppercase.js' ]); });