Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Fix: Error with entry file paths beginning with ./ #45

Merged
merged 2 commits into from
Jul 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export default function nodeResolve ( options ) {
resolveId ( importee, importer ) {
if ( /\0/.test( importee ) ) return null; // ignore IDs with null character, these belong to other plugins

// disregard entry module
if ( !importer ) return null;

let parts = importee.split( /[\/\\]/ );
let id = parts.shift();

Expand All @@ -35,9 +38,6 @@ export default function nodeResolve ( options ) {

if ( skip !== true && ~skip.indexOf( id ) ) return null;

// disregard entry module
if ( !importer ) return null;

return new Promise( ( accept, reject ) => {
resolveId(
importee,
Expand Down
12 changes: 12 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,4 +324,16 @@ describe( 'rollup-plugin-node-resolve', function () {
assert.equal( result, null );
});
});

it( 'supports ./ in entry filename', () => {
return rollup.rollup({
entry: './samples/jsnext/main.js',
plugins: [
nodeResolve({ jsnext: true })
]
}).then( executeBundle ).then( module => {
assert.equal( module.exports, '2H' );
});
});

});