diff --git a/src/index.js b/src/index.js index 376577c..3a93f31 100644 --- a/src/index.js +++ b/src/index.js @@ -64,7 +64,7 @@ export default function commonjs ( options = {} ) { return { resolveId ( importee, importer ) { - if ( importee[0] !== '.' ) return; // not our problem + if ( importee[0] !== '.' || !importer ) return; // not our problem const resolved = resolve( dirname( importer ), importee ); const candidates = getCandidates( resolved, extensions ); diff --git a/test/test.js b/test/test.js index 21846d8..bd60079 100644 --- a/test/test.js +++ b/test/test.js @@ -254,4 +254,11 @@ describe( 'rollup-plugin-commonjs', () => { assert.equal( global.setImmediate, mod.immediate, generated.code ); }); }); + + it( 'does not process the entry file when it has a leading "." (issue #63)', () => { + return rollup({ + entry: './samples/basic/main.js', + plugins: [ commonjs() ] + }).then( executeBundle ); + }); });