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

Commit

Permalink
Merge branch 'master' into fix-windows-resolved-alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris authored Oct 19, 2017
2 parents 8a194dc + 4b8a087 commit 2bec324
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.3.1",
"description": "Resolves aliases with Rollup",
"main": "dist/rollup-plugin-alias.js",
"module": "dist/rollup-plugin-alias.es2015.js",
"jsnext:main": "dist/rollup-plugin-alias.es2015.js",
"scripts": {
"prebuild": "rimraf dist",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function alias(options = {}) {
// First match is supposed to be the correct one
const toReplace = aliasKeys.find(key => matches(key, importeeId));

if (!toReplace) {
if (!toReplace || !importerId) {
return null;
}

Expand Down
10 changes: 10 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ test('Absolute local aliasing', t => {
t.is(resolved4, '/par/a/di/se.js');
});

test('Leaves entry file untouched if matches alias', t => {
const result = alias({
abacaxi: './abacaxi',
});

const resolved = result.resolveId('abacaxi/entry.js', undefined);

t.is(resolved, null);
});

test('Test for the resolve property', t => {
const result = alias({
ember: './folder/hipster',
Expand Down

0 comments on commit 2bec324

Please sign in to comment.